Skip to content

Terraform Module to parse a markdown table and generate security groups from it

License

Notifications You must be signed in to change notification settings

brakf/tf_security_groups_from_markdown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform AWS Dynamic Security Groups Module

This Terraform module creates security groups and their associated ingress/egress rules based on a provided markdown table.

Usage

To use this module, you need to have a markdown file with the security group rules formatted as shown in the example below:

| Security Groups / inbound from => | frontend                                                                                      | backend                                                | database | ssm(/security_groups/external_server)                                                                   | cidr(10.0.0.0/8)                         |
|-----------------------------------|-----------------------------------------------------------------------------------------------|--------------------------------------------------------|----------|---------------------------------------------------------------------------------------------------------|------------------------------------------|
| frontend                          |                                                                                               |                                                        |          | [{"port": 80, "description": "external server"}, {"port": 443, "description": "external server https"}] | [{"port": 443, "description": "public"}] |
| backend                           | [{"port": 80, "description": "from frontend"}, {"port": 443, "description": "from frontend"}] |                                                        |          |                                                                                                         |                                          |
| database                          |                                                                                               | [{"port": 1433, "description": "database connection"}] |          |                                                                                                         |                                          |

Example

module "dynamic_security_groups" {
  source              = "path/to/this/module"
  vpc_id              = "vpc-12345678"
  markdown_file_path  = "path/to/markdown_file.md"
}

Additional Notes

This module supports CIDR blocks and referencing other security groups by name as the source. Additionally, you can use SSM parameters to fetch security group IDs from an external source.
The markdown file should be formatted correctly for the module to work as expected. Please refer to the provided example above.

About

Terraform Module to parse a markdown table and generate security groups from it

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages