Last active
July 19, 2019 14:16
-
-
Save magickatt/a499931fa87f20e60a4cbab96c512103 to your computer and use it in GitHub Desktop.
Iterate over set for resource using count and index in Terraform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_route" "transit_gateway_private_subnet_route" { | |
count = length(data.aws_route_tables.private_subnet.ids) | |
route_table_id = tolist(data.aws_route_tables.private_subnet.ids)[count.index] | |
destination_cidr_block = var.destination_cidr_block | |
transit_gateway_id = var.transit_gateway_id | |
} | |
data "aws_route_tables" "private_subnet" { | |
vpc_id = var.vpc_id | |
tags = { | |
subnet_purpose = "private" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment