-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bucket patch to support goog-provisioned label
- Loading branch information
1 parent
28f873a
commit e1d4277
Showing
13 changed files
with
15 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Venelin <[email protected]> | ||
Date: Wed, 24 Apr 2024 12:49:49 +0100 | ||
Subject: [PATCH] fix label imports | ||
Subject: [PATCH] Allow for no diff on labels for Bucket imports | ||
|
||
|
||
diff --git a/google-beta/services/storage/resource_storage_bucket.go b/google-beta/services/storage/resource_storage_bucket.go | ||
|
@@ -22,10 +22,10 @@ index e4be7399d..8fbeee2ab 100644 | |
} | ||
if err := d.Set("effective_labels", res.Labels); err != nil { | ||
diff --git a/google-beta/tpgresource/labels.go b/google-beta/tpgresource/labels.go | ||
index ffb1515cf..095be91c5 100644 | ||
index ffb1515cf..de278a1b6 100644 | ||
--- a/google-beta/tpgresource/labels.go | ||
+++ b/google-beta/tpgresource/labels.go | ||
@@ -31,6 +31,30 @@ func SetLabels(labels map[string]string, d *schema.ResourceData, lineage string) | ||
@@ -31,6 +31,38 @@ func SetLabels(labels map[string]string, d *schema.ResourceData, lineage string) | ||
return d.Set(lineage, transformed) | ||
} | ||
|
||
|
@@ -38,13 +38,21 @@ index ffb1515cf..095be91c5 100644 | |
+ // We are reading after an update, so populate just the user defined labels. | ||
+ if labels != nil { | ||
+ for k := range v.(map[string]interface{}) { | ||
+ // This label is set by the provider. | ||
+ // It is neither a defaultLabel, nor is it user set. Skip. | ||
+ if k == "goog-pulumi-provisioned" && lineage == "labels" { | ||
+ continue | ||
+ } | ||
+ transformed[k] = labels[k] | ||
+ } | ||
+ } | ||
+ } else { | ||
+ // We are reading for an import, so populate all of the labels, except the skipped ones. | ||
+ for k, v := range labels { | ||
+ if _, ok := defaultLabels[k]; !ok || lineage != "labels" { | ||
+ if k == "goog-pulumi-provisioned" { | ||
+ continue | ||
+ } | ||
+ transformed[k] = v | ||
+ } | ||
+ } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters