From a8c96de28c30618d64d8d4269fdb9dd79770cb12 Mon Sep 17 00:00:00 2001 From: Kamesh Raj Velu Date: Mon, 3 Feb 2025 19:16:47 -0800 Subject: [PATCH] fix(url_map): Adding create_before_destroy lifecycle. The `target_http_proxy` resource depends on the `google_compute_url_map` resource, so Terraform attempts to update the `url_map` first when changes occur. If a custom `url_map` is added, the module tries to delete the default `url_map` before updating the one the `https_proxy` relies on, resulting in an error. --- main.tf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.tf b/main.tf index 9721c9a3..4837f9c6 100644 --- a/main.tf +++ b/main.tf @@ -168,6 +168,10 @@ resource "google_compute_url_map" "default" { count = var.create_url_map ? 1 : 0 name = "${var.name}-url-map" default_service = google_compute_backend_service.default[keys(var.backends)[0]].self_link + + lifecycle { + create_before_destroy = true + } } resource "google_compute_url_map" "https_redirect" {