From 1e415d3b2d2f76514770e19fc2467d4c50f11dde Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Tue, 20 Feb 2024 19:57:06 +0000 Subject: [PATCH] fixes: permadiff issue if event trigger region is not specified (#9989) * fixes: permadiff issue if event trigger region is not specified - fixes https://github.com/hashicorp/terraform-provider-google/issues/17161 * chore: Updated cloudfunction2 test with no explicit trigger_region [upstream:02e719917fd193513b3e580493a2df4e051cafc9] Signed-off-by: Modular Magician --- .changelog/9989.txt | 3 +++ .../cloudfunctions2/resource_cloudfunctions2_function.go | 1 + .../resource_cloudfunctions2_function_generated_test.go | 1 - website/docs/r/cloudfunctions2_function.html.markdown | 1 - 4 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 .changelog/9989.txt diff --git a/.changelog/9989.txt b/.changelog/9989.txt new file mode 100644 index 00000000000..db4cc63cf72 --- /dev/null +++ b/.changelog/9989.txt @@ -0,0 +1,3 @@ +```release-note:bug +cloudfunctions2: fixed an issue where not specifying `event_config.trigger_region` in `google_cloudfunctions2_function` resulted in a permanent diff. The field now pulls a default value from the API when unset. +``` \ No newline at end of file diff --git a/google/services/cloudfunctions2/resource_cloudfunctions2_function.go b/google/services/cloudfunctions2/resource_cloudfunctions2_function.go index d5a2edf505a..9a425235baa 100644 --- a/google/services/cloudfunctions2/resource_cloudfunctions2_function.go +++ b/google/services/cloudfunctions2/resource_cloudfunctions2_function.go @@ -257,6 +257,7 @@ Compute Engine default service account: {project_number}-compute@developer.gserv }, "trigger_region": { Type: schema.TypeString, + Computed: true, Optional: true, Description: `The region that the trigger will be in. The trigger will only receive events originating in this region. It can be the same diff --git a/google/services/cloudfunctions2/resource_cloudfunctions2_function_generated_test.go b/google/services/cloudfunctions2/resource_cloudfunctions2_function_generated_test.go index c0a426ff3d0..00c8941c765 100644 --- a/google/services/cloudfunctions2/resource_cloudfunctions2_function_generated_test.go +++ b/google/services/cloudfunctions2/resource_cloudfunctions2_function_generated_test.go @@ -330,7 +330,6 @@ resource "google_cloudfunctions2_function" "function" { } event_trigger { - trigger_region = "us-central1" # The trigger must be in the same location as the bucket event_type = "google.cloud.storage.object.v1.finalized" retry_policy = "RETRY_POLICY_RETRY" service_account_email = google_service_account.account.email diff --git a/website/docs/r/cloudfunctions2_function.html.markdown b/website/docs/r/cloudfunctions2_function.html.markdown index 77d139e1a8a..cbac3ad8935 100644 --- a/website/docs/r/cloudfunctions2_function.html.markdown +++ b/website/docs/r/cloudfunctions2_function.html.markdown @@ -323,7 +323,6 @@ resource "google_cloudfunctions2_function" "function" { } event_trigger { - trigger_region = "us-central1" # The trigger must be in the same location as the bucket event_type = "google.cloud.storage.object.v1.finalized" retry_policy = "RETRY_POLICY_RETRY" service_account_email = google_service_account.account.email