Skip to content

Instantly share code, notes, and snippets.

Last active Jul 19, 2019
What would you like to do?
Iterate over set for resource using count and index in Terraform
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