Terraform Sleep
Why
Some resources cant have things applied right after each-other, like creating 12 projects then assigning them IAM
How to fix
resource "google_project" "default" {
name = "My Project"
project_id = "your-project-id"
org_id = "1234567"
}
resource "time_sleep" "sleep" {
create_duration = "10s"
depends_on = [google_project.default]
}
resource "google_project" "my_project" {
name = "My Project"
project_id = "your-project-id"
org_id = "1234567"
depends_on = [time_sleep.sleep]
}
The above block will
- Create a google project
- Sleep for 10 seconds
- Apply the Google Project IAM
This is especially useful when running in IAM
Want to make this site better? Open a PR or help fund hosting costs