Dynamic Security Group Module
Usage
Requirements
Providers
Inputs
Outputs
module "test-security-group" {
source = " https://github.com/gallowaystorm/tf-aws-security-group-module.git"
security_group_list = yamldecode (file (" ${ path . module } /security-groups.yaml" ))
region = " us-east-1"
}
Name
Version
terraform
~> 0.13
aws
~> 3.0
Name
Description
Type
Default
Required
security_group_list
This is the list of security groups in YAML format that needs to be decoded with yamldecode (\see example below)
decoded YAML
N/A
yes
Name
Description
security_group_output
n/a
Your YAML file with security groups must follow the template below:
test-security-group :
group_description : " Group Description One"
vpc_id : " vpc-47f30121"
ingress_rules :
- description : " Test description"
is_self_source : " false"
from_port : 80
to_port : 80
protocol : " tcp"
cidr_blocks : ["0.0.0.0/0", "10.10.0.0/16"]
- description : " Test description 2"
is_self_source : " false"
from_port : 443
to_port : 443
protocol : " tcp"
cidr_blocks : ["0.0.0.0/0"]
- description : " Test description 3"
is_self_source : " true"
from_port : 8080
to_port : 8080
protocol : " tcp"
cidr_blocks : ["0.0.0.0/0"]
egress_rules :
- description : " Test description 4"
is_self_source : " false"
from_port : 80
to_port : 80
protocol : " tcp"
cidr_blocks : ["0.0.0.0/0"]
test-security-group-02 :
group_description : " Group Description Two"
vpc_id : " vpc-47f30121"
ingress_rules :
- description : " Test description"
is_self_source : " true"
from_port : 80
to_port : 80
protocol : " tcp"
cidr_blocks : ["0.0.0.0/0", "10.10.0.0/16"]
- description : " Test description 2"
is_self_source : " false"
from_port : 443
to_port : 443
protocol : " tcp"
cidr_blocks : ["0.0.0.0/0"]
- description : " Test description 3"
is_self_source : " false"
from_port : 8080
to_port : 8080
protocol : " tcp"
cidr_blocks : ["0.0.0.0/0"]
egress_rules :
- description : " Test description 4"
is_self_source : " false"
from_port : 80
to_port : 80
protocol : " tcp"
cidr_blocks : ["0.0.0.0/0"]