diff --git a/.changelog/11430.txt b/.changelog/11430.txt new file mode 100644 index 00000000000..a4e2d0f446a --- /dev/null +++ b/.changelog/11430.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +logging: changed enable_analytics parsing to "no preference" in analytics if omitted, instead of explicitly disabling analytics. +``` \ No newline at end of file diff --git a/google/services/logging/resource_logging_project_bucket_config.go b/google/services/logging/resource_logging_project_bucket_config.go index 2a4a79a12b0..8322268c6be 100644 --- a/google/services/logging/resource_logging_project_bucket_config.go +++ b/google/services/logging/resource_logging_project_bucket_config.go @@ -189,7 +189,7 @@ func resourceLoggingProjectBucketConfigAcquireOrCreate(parentType string, iDFunc UserAgent: userAgent, }) if res == nil { - log.Printf("[DEGUG] Loggin Bucket not exist %s", id) + log.Printf("[DEBUG] Logging Bucket does not exist %s", id) // we need to pass the id in here because we don't want to set it in state // until we know there won't be any errors on create return resourceLoggingProjectBucketConfigCreate(d, meta, id) @@ -214,7 +214,11 @@ func resourceLoggingProjectBucketConfigCreate(d *schema.ResourceData, meta inter obj["description"] = d.Get("description") obj["locked"] = d.Get("locked") obj["retentionDays"] = d.Get("retention_days") - obj["analyticsEnabled"] = d.Get("enable_analytics") + // Only set analyticsEnabled if it has been explicitly preferenced. + analyticsRawValue := d.GetRawConfig().GetAttr("enable_analytics") + if !analyticsRawValue.IsNull() { + obj["analyticsEnabled"] = analyticsRawValue.True() + } obj["cmekSettings"] = expandCmekSettings(d.Get("cmek_settings")) obj["indexConfigs"] = expandIndexConfigs(d.Get("index_configs"))