diff --git a/README.md b/README.md index ffe631e3a..6263ba62d 100644 --- a/README.md +++ b/README.md @@ -378,6 +378,7 @@ No modules. | [create\_multiple\_intra\_route\_tables](#input\_create\_multiple\_intra\_route\_tables) | Indicates whether to create a separate route table for each intra subnet. Default: `false` | `bool` | `false` | no | | [create\_multiple\_public\_route\_tables](#input\_create\_multiple\_public\_route\_tables) | Indicates whether to create a separate route table for each public subnet. Default: `false` | `bool` | `false` | no | | [create\_private\_nat\_gateway\_route](#input\_create\_private\_nat\_gateway\_route) | Controls if a nat gateway route should be created to give internet access to the private subnets | `bool` | `true` | no | +| [create\_public\_route\_association](#input\_create\_public\_route\_association) | Option to associate public route tables | `bool` | `true` | no | | [create\_redshift\_subnet\_group](#input\_create\_redshift\_subnet\_group) | Controls if redshift subnet group should be created | `bool` | `true` | no | | [create\_redshift\_subnet\_route\_table](#input\_create\_redshift\_subnet\_route\_table) | Controls if separate route table for redshift should be created | `bool` | `false` | no | | [create\_vpc](#input\_create\_vpc) | Controls if VPC should be created (it affects almost all resources) | `bool` | `true` | no | diff --git a/main.tf b/main.tf index 618aa2c10..74deb15ae 100644 --- a/main.tf +++ b/main.tf @@ -179,7 +179,7 @@ resource "aws_route_table" "public" { } resource "aws_route_table_association" "public" { - count = local.create_public_subnets ? local.len_public_subnets : 0 + count = var.create_public_route_association && local.create_public_subnets ? local.len_public_subnets : 0 subnet_id = element(aws_subnet.public[*].id, count.index) route_table_id = element(aws_route_table.public[*].id, var.create_multiple_public_route_tables ? count.index : 0) diff --git a/variables.tf b/variables.tf index d8338267a..7c2b2193e 100644 --- a/variables.tf +++ b/variables.tf @@ -274,6 +274,12 @@ variable "public_route_table_tags" { default = {} } +variable "create_public_route_association" { + description = "Option to associate public route tables" + type = bool + default = true +} + ################################################################################ # Public Network ACLs ################################################################################ diff --git a/versions.tf b/versions.tf index 8dceb0cc1..72719e3c5 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 5.79" + version = "~> 6.0" } } } diff --git a/vpc-flow-logs.tf b/vpc-flow-logs.tf index 4c2910546..fc7ba90be 100644 --- a/vpc-flow-logs.tf +++ b/vpc-flow-logs.tf @@ -25,7 +25,7 @@ locals { flow_log_cloudwatch_log_group_name_suffix = var.flow_log_cloudwatch_log_group_name_suffix == "" ? local.vpc_id : var.flow_log_cloudwatch_log_group_name_suffix flow_log_group_arns = [ for log_group in aws_cloudwatch_log_group.flow_log : - "arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].name}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*" + "arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].region}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*" ] }