From b5182cb3a456e2bb53bb02d0b0bfbb66c653d94b Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 22 Jan 2024 14:24:21 -0800 Subject: [PATCH] fix: permadiff issue when `docker_repository` field is not specified (#9850) (#6887) relates to https://github.com/GoogleCloudPlatform/cloud-foundation-fabric/pull/1987 When docker repository is not specified by default docker repository`projects/PROJECT_ID/locations/REGION/repositories/gcf-artifacts` is used.In such a case, terraform plan always generates a difference for `docker_repository`field as the module passes null value but the tfstate file has the above specifieddefault value. This fix allows one to prevent unnecessary infrastructure change. [upstream:3540e663502c1286967dd61650bb8ee7c2b35cf9] Signed-off-by: Modular Magician --- .changelog/9850.txt | 3 +++ .../cloudfunctions2/resource_cloudfunctions2_function.go | 1 + 2 files changed, 4 insertions(+) create mode 100644 .changelog/9850.txt diff --git a/.changelog/9850.txt b/.changelog/9850.txt new file mode 100644 index 0000000000..78e9fee961 --- /dev/null +++ b/.changelog/9850.txt @@ -0,0 +1,3 @@ +```release-note:bug +Fixed an issue when `docker_repository` is not specified in build_config section of the `google_cloudfunctions2_function`, the provider should not generate a diff during plan for the default value used by the API. +``` diff --git a/google-beta/services/cloudfunctions2/resource_cloudfunctions2_function.go b/google-beta/services/cloudfunctions2/resource_cloudfunctions2_function.go index 43b1f3ea6d..9d1375e9f5 100644 --- a/google-beta/services/cloudfunctions2/resource_cloudfunctions2_function.go +++ b/google-beta/services/cloudfunctions2/resource_cloudfunctions2_function.go @@ -78,6 +78,7 @@ from the given source.`, Schema: map[string]*schema.Schema{ "docker_repository": { Type: schema.TypeString, + Computed: true, Optional: true, Description: `User managed repository created in Artifact Registry optionally with a customer managed encryption key.`, },