Skip to content

Commit 11092fa

Browse files
logging_project_bucket_config: support "no preference" for enable_analytics setting. (#11430) (#19126)
[upstream:90589fba9e124d25ece290f144942815c267daf5] Signed-off-by: Modular Magician <magic-modules@google.com>
1 parent 79dc8ac commit 11092fa

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.changelog/11430.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
logging: changed enable_analytics parsing to "no preference" in analytics if omitted, instead of explicitly disabling analytics.
3+
```

google/services/logging/resource_logging_project_bucket_config.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func resourceLoggingProjectBucketConfigAcquireOrCreate(parentType string, iDFunc
189189
UserAgent: userAgent,
190190
})
191191
if res == nil {
192-
log.Printf("[DEGUG] Loggin Bucket not exist %s", id)
192+
log.Printf("[DEBUG] Logging Bucket does not exist %s", id)
193193
// we need to pass the id in here because we don't want to set it in state
194194
// until we know there won't be any errors on create
195195
return resourceLoggingProjectBucketConfigCreate(d, meta, id)
@@ -214,7 +214,11 @@ func resourceLoggingProjectBucketConfigCreate(d *schema.ResourceData, meta inter
214214
obj["description"] = d.Get("description")
215215
obj["locked"] = d.Get("locked")
216216
obj["retentionDays"] = d.Get("retention_days")
217-
obj["analyticsEnabled"] = d.Get("enable_analytics")
217+
// Only set analyticsEnabled if it has been explicitly preferenced.
218+
analyticsRawValue := d.GetRawConfig().GetAttr("enable_analytics")
219+
if !analyticsRawValue.IsNull() {
220+
obj["analyticsEnabled"] = analyticsRawValue.True()
221+
}
218222
obj["cmekSettings"] = expandCmekSettings(d.Get("cmek_settings"))
219223
obj["indexConfigs"] = expandIndexConfigs(d.Get("index_configs"))
220224

0 commit comments

Comments
 (0)