diff --git a/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/apps.tf b/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/apps.tf index f4b2aa0c..08a8f0bf 100644 --- a/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/apps.tf +++ b/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/apps.tf @@ -2,10 +2,6 @@ locals { app_subnet = var.app_subnet_cidr != [] ? aws_subnet.app_subnet : data.aws_subnet.appftd } -data "template_file" "apache_install" { - template = file("${path.module}/apache_install.tpl") -} - data "aws_subnet" "appftd" { count = var.app_subnet_cidr == [] ? length(var.app_subnet_name) : 0 filter { @@ -34,8 +30,8 @@ resource "aws_network_interface" "ftd_app" { } resource "aws_security_group" "app_sg" { - name = "App SG" - vpc_id = module.network.vpc_id + name = "App SG" + vpc_id = module.network.vpc_id dynamic "ingress" { @@ -50,10 +46,10 @@ resource "aws_security_group" "app_sg" { } egress { - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] } } @@ -82,18 +78,19 @@ resource "aws_instance" "EC2-Ubuntu" { aws_instance.testLinux ] count = 2 - ami = "ami-0851b76e8b1bce90b" + ami = data.aws_ami.ubuntu.image_id instance_type = "t2.micro" key_name = var.keyname - - user_data = data.template_file.apache_install.rendered + + user_data = base64encode(templatefile("${path.module}/apache_install.tpl", {})) + network_interface { network_interface_id = aws_network_interface.ftd_app[count.index].id device_index = 0 } tags = { - Name = "Ec2-Ubuntu${count.index+1}" + Name = "Ec2-Ubuntu${count.index + 1}" } } @@ -114,19 +111,19 @@ resource "aws_lb" "app-lb" { } resource "aws_lb_listener" "app_listener" { - for_each = { for k, v in var.internal_listener_ports : k => v } + for_each = { for k, v in var.internal_listener_ports : k => v } load_balancer_arn = aws_lb.app-lb.arn port = each.value.port protocol = each.value.protocol default_action { type = "forward" target_group_arn = aws_lb_target_group.app_front_end[each.key].arn - } + } } resource "aws_lb_target_group" "app_front_end" { #for_each = var.create == "both" || var.create == "internal" ? var.internal_listener_ports : [] - for_each = { for k, v in var.internal_listener_ports : k => v } + for_each = { for k, v in var.internal_listener_ports : k => v } name = tostring("fe2-1-${each.key}") port = each.value.port protocol = each.value.protocol @@ -157,4 +154,4 @@ output "app_subnet" { output "app_interface_ip" { value = aws_network_interface.ftd_app.*.private_ip_list -} \ No newline at end of file +} diff --git a/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/bastion.tf b/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/bastion.tf index e2e8728a..9918e2ed 100644 --- a/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/bastion.tf +++ b/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/bastion.tf @@ -1,13 +1,9 @@ -data "template_file" "bastion_install" { - template = file("${path.module}/bastion_install.tpl") -} - data "aws_availability_zones" "available" {} resource "aws_subnet" "bastion_subnet" { - vpc_id = module.network.vpc_id - cidr_block = var.bastion_subnet_cidr - availability_zone = data.aws_availability_zones.available.names[0] + vpc_id = module.network.vpc_id + cidr_block = var.bastion_subnet_cidr + availability_zone = data.aws_availability_zones.available.names[0] map_public_ip_on_launch = true tags = merge({ @@ -16,9 +12,9 @@ resource "aws_subnet" "bastion_subnet" { } resource "aws_network_interface" "bastion_interface" { - description = "bastion-interface" - subnet_id = aws_subnet.bastion_subnet.id - private_ips = [var.bastion_ip] + description = "bastion-interface" + subnet_id = aws_subnet.bastion_subnet.id + private_ips = [var.bastion_ip] } resource "aws_network_interface_sg_attachment" "bastion_attachment" { @@ -46,10 +42,10 @@ resource "aws_route" "bastion_default_route" { } resource "aws_instance" "testLinux" { - ami = "ami-0851b76e8b1bce90b" + ami = data.aws_ami.ubuntu.image_id instance_type = "t2.micro" - key_name = var.keyname - user_data = data.template_file.bastion_install.rendered + key_name = var.keyname + user_data = base64encode(templatefile("${path.module}/bastion_install.tfpl", {})) network_interface { network_interface_id = aws_network_interface.bastion_interface.id device_index = 0 @@ -61,8 +57,8 @@ resource "aws_instance" "testLinux" { } resource "aws_security_group" "bastion_sg" { - name = "Bastion SG" - vpc_id = module.network.vpc_id + name = "Bastion SG" + vpc_id = module.network.vpc_id dynamic "ingress" { @@ -77,10 +73,10 @@ resource "aws_security_group" "bastion_sg" { } egress { - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] } } diff --git a/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/bastion_install.tpl b/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/bastion_install.tfpl similarity index 89% rename from AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/bastion_install.tpl rename to AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/bastion_install.tfpl index 0e91837f..a08724ee 100644 --- a/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/bastion_install.tpl +++ b/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/bastion_install.tfpl @@ -9,4 +9,4 @@ sudo wget --input-file /todownload.txt sudo wget --input-file /todownload1.txt cd .. tar -czvf archive.tar.gz /web -python3 -m http.server --bind 0.0.0.0 9000 \ No newline at end of file +python3 -m http.server --bind 0.0.0.0 9000 diff --git a/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/data.tf b/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/data.tf new file mode 100644 index 00000000..105ffccf --- /dev/null +++ b/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/data.tf @@ -0,0 +1,16 @@ +data "aws_ami" "ubuntu" { + + most_recent = true + + filter { + name = "name" + values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"] + } + + filter { + name = "virtualization-type" + values = ["hvm"] + } + + owners = ["099720109477"] +} diff --git a/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/instances.tf b/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/instances.tf index 009bf4b6..6a3091da 100644 --- a/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/instances.tf +++ b/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/instances.tf @@ -12,4 +12,4 @@ module "instance" { ftd_inside_interface = module.network.inside_interface ftd_diag_interface = module.network.diag_interface fmcmgmt_interface = module.network.fmcmgmt_interface -} \ No newline at end of file +} diff --git a/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/terraform.tfvars b/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/terraform.tfvars index b4c842c8..e1f1c8c9 100644 --- a/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/terraform.tfvars +++ b/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/terraform.tfvars @@ -6,16 +6,16 @@ ############################################################# aws_access_key = "" aws_secret_key = "" -region = "ap-south-1" +region = "ap-south-1" ############################################################ #Define New VPC in a specific Region and Avilability Zone ############################################################# -vpc_name = "IAC-VPC" -vpc_cidr = "" +vpc_name = "IAC-VPC" +vpc_cidr = "10.0.0.0/16" create_igw = false # Generate the key if you want to login thru the key -keyname = "lx1" +keyname = "lx1" instances_per_az = 1 availability_zone_count = 2 @@ -23,104 +23,104 @@ availability_zone_count = 2 #Define CIDR, Subnets for managment and three for Inside, Outisde and Diag ################################################################################### -mgmt_subnet_cidr = ["10.0.1.0/24","10.0.10.0/24"] -outside_subnet_cidr = ["10.0.2.0/24","10.0.20.0/24"] -inside_subnet_cidr = ["10.0.3.0/24","10.0.30.0/24"] -diag_subnet_cidr = ["10.0.4.0/24","10.0.40.0/24"] -app_subnet_cidr = ["10.0.5.0/24","10.0.50.0/24"] +mgmt_subnet_cidr = ["10.0.1.0/24", "10.0.10.0/24"] +outside_subnet_cidr = ["10.0.2.0/24", "10.0.20.0/24"] +inside_subnet_cidr = ["10.0.3.0/24", "10.0.30.0/24"] +diag_subnet_cidr = ["10.0.4.0/24", "10.0.40.0/24"] +app_subnet_cidr = ["10.0.5.0/24", "10.0.50.0/24"] bastion_subnet_cidr = "10.0.6.0/24" -ftd_mgmt_ip = ["10.0.1.10","10.0.10.10"] -ftd_outside_ip = ["10.0.2.10","10.0.20.10"] -ftd_inside_ip = ["10.0.3.10","10.0.30.10"] -ftd_diag_ip = ["10.0.4.10","10.0.40.10"] -ftd_app_ip = ["10.0.5.10","10.0.50.10"] -bastion_ip = "10.0.6.10" -fmc_ip = "10.0.1.50" +ftd_mgmt_ip = ["10.0.1.10", "10.0.10.10"] +ftd_outside_ip = ["10.0.2.10", "10.0.20.10"] +ftd_inside_ip = ["10.0.3.10", "10.0.30.10"] +ftd_diag_ip = ["10.0.4.10", "10.0.40.10"] +ftd_app_ip = ["10.0.5.10", "10.0.50.10"] +bastion_ip = "10.0.6.10" +fmc_ip = "10.0.1.50" -inside_subnet_name = ["inside1","inside2"] -outside_subnet_name = ["outside1","outside2"] -mgmt_subnet_name = ["mgmt1","mgmt2"] -diag_subnet_name = ["diag1","diag2"] -app_subnet_name = ["app1","app2"] +inside_subnet_name = ["inside1", "inside2"] +outside_subnet_name = ["outside1", "outside2"] +mgmt_subnet_name = ["mgmt1", "mgmt2"] +diag_subnet_name = ["diag1", "diag2"] +app_subnet_name = ["app1", "app2"] bastion_subnet_name = "bastion" create = "external" outside_interface_sg = [ - { - from_port = 80 - protocol = "TCP" - to_port = 80 - cidr_blocks = ["10.0.2.0/24","10.0.20.0/24"] - }, - { - from_port = 22 - protocol = "TCP" - to_port = 22 - cidr_blocks = ["10.0.2.0/24","10.0.20.0/24"] - } + { + from_port = 80 + protocol = "TCP" + to_port = 80 + cidr_blocks = ["10.0.2.0/24", "10.0.20.0/24"] + }, + { + from_port = 22 + protocol = "TCP" + to_port = 22 + cidr_blocks = ["10.0.2.0/24", "10.0.20.0/24"] + } ] inside_interface_sg = [ - { - from_port = 80 - protocol = "TCP" - to_port = 80 - cidr_blocks = ["10.0.5.10/32","10.0.50.10/32"] - } + { + from_port = 80 + protocol = "TCP" + to_port = 80 + cidr_blocks = ["10.0.5.10/32", "10.0.50.10/32"] + } ] mgmt_interface_sg = [ - { - from_port = 8305 - protocol = "TCP" - to_port = 8305 - cidr_blocks = ["10.0.1.50/32"] - } + { + from_port = 8305 + protocol = "TCP" + to_port = 8305 + cidr_blocks = ["10.0.1.50/32"] + } ] fmc_mgmt_interface_sg = [ - { - from_port = 443 - protocol = "TCP" - to_port = 443 - cidr_blocks = ["0.0.0.0/0"] - }, - { - from_port = 8305 - protocol = "TCP" - to_port = 8305 - cidr_blocks = ["10.0.1.10/32","10.0.10.10/32"] - } + { + from_port = 443 + protocol = "TCP" + to_port = 443 + cidr_blocks = ["0.0.0.0/0"] + }, + { + from_port = 8305 + protocol = "TCP" + to_port = 8305 + cidr_blocks = ["10.0.1.10/32", "10.0.10.10/32"] + } ] bastion_interface_sg = [ - { - from_port = 80 - protocol = "TCP" - to_port = 80 - cidr_blocks = ["10.0.5.10/32","10.0.50.10/32"] - }, - { - from_port = 22 - protocol = "TCP" - to_port = 22 - cidr_blocks = ["10.0.5.10/32","10.0.50.10/32"] - } + { + from_port = 80 + protocol = "TCP" + to_port = 80 + cidr_blocks = ["10.0.5.10/32", "10.0.50.10/32"] + }, + { + from_port = 22 + protocol = "TCP" + to_port = 22 + cidr_blocks = ["10.0.5.10/32", "10.0.50.10/32"] + } ] app_interface_sg = [ - { - from_port = 80 - protocol = "TCP" - to_port = 80 - cidr_blocks = ["10.0.5.100/32","10.0.50.100/32"] - }, - { - from_port = 22 - protocol = "TCP" - to_port = 22 - cidr_blocks = ["10.0.5.100/32","10.0.50.100/32"] - } -] \ No newline at end of file + { + from_port = 80 + protocol = "TCP" + to_port = 80 + cidr_blocks = ["10.0.5.100/32", "10.0.50.100/32"] + }, + { + from_port = 22 + protocol = "TCP" + to_port = 22 + cidr_blocks = ["10.0.5.100/32", "10.0.50.100/32"] + } +] diff --git a/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/variables.tf b/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/variables.tf index 837ec096..95898a07 100644 --- a/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/variables.tf +++ b/AWS_Workshop/AWS_Workshop_Code/Working_Directory/Resources/variables.tf @@ -1,10 +1,14 @@ -variable "aws_access_key" {} - -variable "aws_secret_key" {} +variable "aws_access_key" { + default = null +} + +variable "aws_secret_key" { + default = null +} variable "region" { - type = string + type = string default = "us-east-1" } @@ -122,12 +126,12 @@ variable "fmc_interface_id" { } variable "FTD_version" { - type = string + type = string default = "ftdv-7.1.0" } variable "FMC_version" { - type = string + type = string default = "fmcv-7.1.0" } @@ -141,24 +145,24 @@ variable "ftd_size" { variable "external_listener_ports" { default = [{ - protocol = "TCP" - port = 80 + protocol = "TCP" + port = 80 target_type = "ip" }] } variable "internal_listener_ports" { default = [{ - protocol = "TCP" - port = 80 + protocol = "TCP" + port = 80 target_type = "ip" - } + } ] } #list the possible options as allowed values -variable "create"{ - type = string +variable "create" { + type = string default = "both" } @@ -302,3 +306,9 @@ variable "app_interface_sg" { cidr_blocks = ["0.0.0.0/0"] }] } + +variable "ftd_ami_id" { + description = "AMI id for syndey region" + default = "ami-0b1e3b793700d6a54" + +} diff --git a/AWS_Workshop/AWS_Workshop_Code/module/FirewallServer/data.tf b/AWS_Workshop/AWS_Workshop_Code/module/FirewallServer/data.tf index 2f940c5b..8265b0f1 100644 --- a/AWS_Workshop/AWS_Workshop_Code/module/FirewallServer/data.tf +++ b/AWS_Workshop/AWS_Workshop_Code/module/FirewallServer/data.tf @@ -1,8 +1,8 @@ data "aws_ami" "ftdv" { #most_recent = true // you can enable this if you want to deploy more - owners = ["aws-marketplace"] + owners = ["aws-marketplace"] - filter { + filter { name = "name" values = ["${var.FTD_version}*"] } @@ -18,19 +18,10 @@ data "aws_ami" "ftdv" { } } -data "template_file" "ftd_startup_file" { - count = var.instances_per_az * var.availability_zone_count - template = file("${path.module}/ftd_startup_file.txt") - vars = { - fmc_ip = var.fmc_mgmt_ip - fmc_nat_id = var.fmc_nat_id - reg_key = var.reg_key - } -} data "aws_ami" "fmcv" { #most_recent = true // you can enable this if you want to deploy more - owners = ["aws-marketplace"] + owners = ["aws-marketplace"] filter { name = "name" values = ["${var.FMC_version}*"] @@ -45,15 +36,7 @@ data "aws_ami" "fmcv" { } } -data "template_file" "fmc_startup_file" { - template = file("${path.module}/fmc_startup_file.txt") - vars = { - fmc_admin_password = var.fmc_admin_password - fmc_hostname = var.fmc_hostname - } -} - data "aws_availability_zones" "available" { - state = "available" + state = "available" } diff --git a/AWS_Workshop/AWS_Workshop_Code/module/FirewallServer/fmc_startup_file.txt b/AWS_Workshop/AWS_Workshop_Code/module/FirewallServer/fmc_startup_file.txt.tfpl similarity index 100% rename from AWS_Workshop/AWS_Workshop_Code/module/FirewallServer/fmc_startup_file.txt rename to AWS_Workshop/AWS_Workshop_Code/module/FirewallServer/fmc_startup_file.txt.tfpl diff --git a/AWS_Workshop/AWS_Workshop_Code/module/FirewallServer/ftd_startup_file.txt b/AWS_Workshop/AWS_Workshop_Code/module/FirewallServer/ftd_startup_file.txt.tfpl similarity index 100% rename from AWS_Workshop/AWS_Workshop_Code/module/FirewallServer/ftd_startup_file.txt rename to AWS_Workshop/AWS_Workshop_Code/module/FirewallServer/ftd_startup_file.txt.tfpl diff --git a/AWS_Workshop/AWS_Workshop_Code/module/FirewallServer/main.tf b/AWS_Workshop/AWS_Workshop_Code/module/FirewallServer/main.tf index 17279388..3ba2771a 100644 --- a/AWS_Workshop/AWS_Workshop_Code/module/FirewallServer/main.tf +++ b/AWS_Workshop/AWS_Workshop_Code/module/FirewallServer/main.tf @@ -1,43 +1,56 @@ # # ################################################################################################################################## # # # Create the Cisco FMC and FTD Instances # # ################################################################################################################################## +locals { + rendered_ftd_startup_files = [ + for idx in range(var.instances_per_az * var.availability_zone_count) : templatefile("${path.module}/ftd_startup_file.txt.tfpl", { + fmc_ip = var.fmc_mgmt_ip, + fmc_nat_id = var.fmc_nat_id, + reg_key = var.reg_key + }) + ] +} resource "aws_instance" "ftdv" { - count = var.instances_per_az * var.availability_zone_count - ami = data.aws_ami.ftdv.id - instance_type = var.ftd_size - key_name = var.keyname + count = var.instances_per_az * var.availability_zone_count + ami = data.aws_ami.ftdv.id + instance_type = var.ftd_size + key_name = var.keyname network_interface { - network_interface_id = element(var.ftd_mgmt_interface,count.index) + network_interface_id = element(var.ftd_mgmt_interface, count.index) device_index = 0 } network_interface { - network_interface_id = element(var.ftd_diag_interface,count.index) + network_interface_id = element(var.ftd_diag_interface, count.index) device_index = 1 } network_interface { - network_interface_id = element(var.ftd_outside_interface,count.index) + network_interface_id = element(var.ftd_outside_interface, count.index) device_index = 2 } network_interface { - network_interface_id = element(var.ftd_inside_interface,count.index) + network_interface_id = element(var.ftd_inside_interface, count.index) device_index = 3 } - user_data = data.template_file.ftd_startup_file[count.index].rendered + user_data = local.rendered_ftd_startup_files[count.index] tags = merge({ Name = "Cisco ftdv${count.index}" - },var.tags) + }, var.tags) } resource "aws_instance" "fmcv" { - ami = data.aws_ami.fmcv.id - instance_type = "c5.4xlarge" - key_name = var.keyname + ami = data.aws_ami.fmcv.id + instance_type = "c5.4xlarge" + key_name = var.keyname network_interface { network_interface_id = var.fmcmgmt_interface device_index = 0 } - user_data = data.template_file.fmc_startup_file.rendered + user_data = base64encode(templatefile("${path.module}/fmc_startup_file.txt.tfpl", + { + fmc_admin_password = var.fmc_admin_password + fmc_hostname = var.fmc_hostname + })) tags = { Name = "Cisco FMCv" } diff --git a/AWS_Workshop/AWS_Workshop_Code/module/Network/locals.tf b/AWS_Workshop/AWS_Workshop_Code/module/Network/locals.tf index 4171fe20..01e97cc2 100644 --- a/AWS_Workshop/AWS_Workshop_Code/module/Network/locals.tf +++ b/AWS_Workshop/AWS_Workshop_Code/module/Network/locals.tf @@ -1,9 +1,9 @@ locals { - con = var.vpc_cidr != "" ? aws_vpc.asa_vpc[0].id : data.aws_vpc.asa_vpc[0].id - instances = var.availability_zone_count * var.instances_per_az - mgmt_subnet = var.mgmt_subnet_cidr != [] ? aws_subnet.mgmt_subnet : data.aws_subnet.mgmt - inside_subnet = var.inside_subnet_cidr != [] ? aws_subnet.inside_subnet : data.aws_subnet.insideftd + con = var.vpc_cidr != "" ? aws_vpc.asa_vpc[0].id : data.aws_vpc.asa_vpc[0].id + instances = var.availability_zone_count * var.instances_per_az + mgmt_subnet = var.mgmt_subnet_cidr != [] ? aws_subnet.mgmt_subnet : data.aws_subnet.mgmt + inside_subnet = var.inside_subnet_cidr != [] ? aws_subnet.inside_subnet : data.aws_subnet.insideftd outside_subnet = var.outside_subnet_cidr != [] ? aws_subnet.outside_subnet : data.aws_subnet.outsideftd - diag_subnet = var.diag_subnet_cidr != [] ? aws_subnet.diag_subnet : data.aws_subnet.diagftd - azs = chunklist(sort(flatten(chunklist(setproduct(range(local.instances), range(1, (var.availability_zone_count + 1))), local.instances)[0])), local.instances)[1] + diag_subnet = var.diag_subnet_cidr != [] ? aws_subnet.diag_subnet : data.aws_subnet.diagftd + azs = chunklist(sort(flatten(chunklist(setproduct(range(local.instances), range(1, (var.availability_zone_count + 1))), local.instances)[0])), local.instances)[1] } diff --git a/AWS_Workshop/AWS_Workshop_Code/module/Network/main.tf b/AWS_Workshop/AWS_Workshop_Code/module/Network/main.tf index 524fd78f..f14fea13 100644 --- a/AWS_Workshop/AWS_Workshop_Code/module/Network/main.tf +++ b/AWS_Workshop/AWS_Workshop_Code/module/Network/main.tf @@ -57,8 +57,8 @@ resource "aws_subnet" "diag_subnet" { # # ################################################################################################################################# resource "aws_security_group" "outside_sg" { - name = "Outside Interface SG" - vpc_id = local.con + name = "Outside Interface SG" + vpc_id = local.con dynamic "ingress" { for_each = var.outside_interface_sg @@ -72,16 +72,16 @@ resource "aws_security_group" "outside_sg" { } egress { - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] } } resource "aws_security_group" "inside_sg" { - name = "Inside Interface SG" - vpc_id = local.con + name = "Inside Interface SG" + vpc_id = local.con dynamic "ingress" { for_each = var.inside_interface_sg @@ -95,16 +95,16 @@ resource "aws_security_group" "inside_sg" { } egress { - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] } } resource "aws_security_group" "mgmt_sg" { - name = "FTD Management Interface SG" - vpc_id = local.con + name = "FTD Management Interface SG" + vpc_id = local.con dynamic "ingress" { for_each = var.mgmt_interface_sg @@ -118,16 +118,16 @@ resource "aws_security_group" "mgmt_sg" { } egress { - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] } } resource "aws_security_group" "fmc_mgmt_sg" { - name = "FMC Management Interface SG" - vpc_id = local.con + name = "FMC Management Interface SG" + vpc_id = local.con dynamic "ingress" { for_each = var.fmc_mgmt_interface_sg @@ -141,16 +141,16 @@ resource "aws_security_group" "fmc_mgmt_sg" { } egress { - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] } } resource "aws_security_group" "no_access" { - name = "No Access" - vpc_id = local.con + name = "No Access" + vpc_id = local.con } # # ################################################################################################################################## @@ -284,7 +284,7 @@ resource "aws_eip_association" "ftd-mgmt-ip-assocation" { } resource "aws_eip" "fmcmgmt-EIP" { - vpc = true + vpc = true tags = { "Name" = "FMCv Management IP" } diff --git a/AWS_Workshop/AWS_Workshop_Code/module/Network/variables.tf b/AWS_Workshop/AWS_Workshop_Code/module/Network/variables.tf index e4db8b10..9608cb7f 100644 --- a/AWS_Workshop/AWS_Workshop_Code/module/Network/variables.tf +++ b/AWS_Workshop/AWS_Workshop_Code/module/Network/variables.tf @@ -5,7 +5,7 @@ variable "vpc_cidr" { variable "vpc_name" { type = string - default = "IAC-VPC" + default = "IAC-VPC" } variable "create_igw" { @@ -58,24 +58,24 @@ variable "ftd_inside_ip" { } variable "fmc_ip" { - type = string + type = string default = "" } #provide default values for subnet name as it is used in both cases variable "mgmt_subnet_name" { type = list(string) - default = ["mgmt1","mgmt2"] + default = ["mgmt1", "mgmt2"] } variable "outside_subnet_name" { type = list(string) - default = ["outside1","outside2"] + default = ["outside1", "outside2"] } variable "inside_subnet_name" { type = list(string) - default = ["inside1","inside2"] + default = ["inside1", "inside2"] } variable "diag_subnet_name" {