OpenStack Security Group Terraform Module
Security group with pre-defined rules
module "sg" {
source = "./modules/terraform-openstack-modules/terraform-openstack-security"
name = "staging-sg"
ingress_cidr = "10.20.30.0/24"
ingress_rules = ["ssh-tcp"]
tags = ["staging"]
}
Security group with custom rules
module "sg" {
source = "./modules/terraform-openstack-modules/terraform-openstack-security"
name = "custom-sg"
ingress_with_cidr_blocks = [
{
rule = "postgresql-tcp"
cidr_block = "0.0.0.0/0"
},
{
rule = "postgresql-tcp"
cidr_block = "30.30.30.30/32"
},
{
from_port = 10
to_port = 20
protocol = 6
description = "Service name"
cidr_block = "10.10.0.0/20"
},
]
tags = ["staging"]
}
No modules.
Name |
Description |
Type |
Default |
Required |
create_sg |
Whether to create security group |
bool |
true |
no |
description |
Description of security group |
string |
"Security Group managed by Terraform" |
no |
ingress_cidr |
IPv4 CIDR to use on all ingress rules |
string |
"0.0.0.0/0" |
no |
ingress_rules |
List of ingress rules to create by name |
list(string) |
[] |
no |
ingress_with_cidr_blocks |
List of ingress rules to create where 'cidr_blocks' is used |
list(map(string)) |
[] |
no |
name |
Name of security group - not required if create_sg is false |
string |
null |
no |
security_group_id |
ID of existing security group whose rules we will manage |
string |
null |
no |
tags |
A list of tags to assign to security group |
list(string) |
[] |
no |