Open
Description
Terraform CLI and Provider Versions
Terraform v1.4.5
on linux_amd64
hashicorp/google v4.63.0
Terraform Configuration
resource "google_access_context_manager_service_perimeter_resource" "service-perimeter-resource" {
perimeter_name = local.vpc_sc_perimeter
...
}
resource "time_sleep" "wait_for_vpc_sc" {
create_duration = "30s"
depends_on = [google_access_context_manager_service_perimeter_resource.service-perimeter-resource]
}
# Adding to Shared VPC as service projects
resource "google_compute_shared_vpc_service_project" "service_projects" {
for_each = { for project in local.projects : project.id => project }
host_project = each.value.shared_vpc_host
service_project = each.value.id
depends_on = [time_sleep.wait_for_vpc_sc]
}
Expected Behavior
The intention is to wait for 30 seconds and then start attaching projects to a Shared VPC host project.
Actual Behavior
The time_sleep resource does not take effect - TF tried to create resources right after the VPC-SC call. The time_sleep doesn't not even show up in terraform plan output. Once I removed the for_each statement so there is only one project is attached, the time_sleep resource shows up in the plan and works properly
Steps to Reproduce
Terraform plan will show you the differences between having for_each or no for_each.
Turn on TF_LOG=DEBUG, you will see that the time_sleep is not called.
How much impact is this issue causing?
High
Logs
No response
Additional Information
No response
Code of Conduct
- I agree to follow this project's Code of Conduct