terraform-training/Modules/Compute/security_group
2024-05-30 18:29:03 +08:00
..
main.tf UPD: added CfIps.json and security_group module 2024-05-30 18:29:03 +08:00
outputs.tf UPD: added CfIps.json and security_group module 2024-05-30 18:29:03 +08:00
README.md UPD: added CfIps.json and security_group module 2024-05-30 18:29:03 +08:00
variables.tf UPD: added CfIps.json and security_group module 2024-05-30 18:29:03 +08:00

security-group

This module create security group.

Inputs

Name Description Type Default Required
vpc-id VPC id string n/a yes
ingress See example below map n/a yes
egress See example below map n/a yes

Outputs

Name Description
sg-id-name A map of SG id and their names

Example

Below is a sample root module calling this shared module

module "admin-sg" {

  source = "../../modules/compute/security_group"

  description = "Security group for admins"
  egress = {
    r1 = "tcp,4750,4750,1.2.3.4/32,Patch Management Tool"
    r2 = "tcp,22,22,1.2.3.4/32,Patch Management Tool"
    r3 = "tcp,52311,52311,${aws_ec2_managed_prefix_list.bigfix.id},Client to BigFix server"
    r4 = "-1,-1,-1,0.0.0.0/0,Outbound access"
  }
  ingress = {
    r1  = "tcp,4750,4750,1.2.3.4/32,Patch Management Tool"
    r2  = "tcp,22,22,1.2.3.4/32,Patch Management Tool"
    r3  = "tcp,52311,52311,${aws_ec2_managed_prefix_list.bigfix.id},BigFix server to client"
  }
  name   = "admin-sg"
  vpc-id = "vpc-01a10b033169f89a8"
}