For terraform, resource, is the local ran after or before the resource is called?
The reason being, when my local is ran in the below code, not all the resources in the aws_vpn_connection.VPN-CONN are ready, so my tga_vpn is not complete, and thereby, not all resources are created in aws_ec2_transit_gateway_route_table_propagation resource
I have to run terraform apply again to add the remaining resources.
locals {
tga_vpn = flatten([
for vpn_conn in aws_vpn_connection.VPN-CONN:
.
.
])
}
resource "aws_ec2_transit_gateway_route_table_propagation" "TGW-RT-PROP" {
count = length(local.tga_vpn)
something1 = lookup(local.tga_vpn[count.index], "id1", null)
something2 = lookup(local.tga_vpn[count.index], "id2", null)
}
I also added depends on aws_vpn_connection in the aws_ec2_transit_gateway_route_table_propagation resource, but that did not help.
Or is there a way to add depends_on for local?
Thank you