Skip to content

Troubleshooting Terraform cycles

One of the most difficult types of issues to troubleshoot with Terraform is when we're hit with a cycles error like:

│ Error: Cycle: google_secret_manager_secret_version.otel_config["us-central1"] (destroy deposed a32a8723),
 google_secret_manager_secret_version.otel_config["asia-northeast3"] (destroy deposed 50af4dba),
 google_cloud_run_v2_service.[MASKED]_service["us-central1"],
 google_cloud_run_v2_service.[MASKED]_service["asia-northeast3"],
 google_secret_manager_secret_version.otel_config["europe-west1"],
 google_secret_manager_secret_version.otel_config["us-central1"],
 google_cloud_run_v2_service.[MASKED]_service (expand),
 google_cloud_run_v2_service.[MASKED]_service["europe-west1"],
 google_secret_manager_secret_version.otel_config["europe-west1"] (destroy deposed 18f61a69),
 google_secret_manager_secret.otel_config (destroy),
 google_secret_manager_secret_version.otel_config["asia-northeast3"]

It might help if we add a job before the Terraform plan that runs terraform graph -draw-cycles and saves it as an artifact.

Edited by Sylvester Chin