Skip to content

Commit 9f4dc04

Browse files
Mark accessLoggingConfig immutable in apigee instance (#14494) (#23571)
[upstream:0921cba602d8452c5971b65abae622e742ab4f83] Signed-off-by: Modular Magician <[email protected]>
1 parent f9f3cdf commit 9f4dc04

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

.changelog/14494.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
apigee: marked the field `access_logging_config` immutable in `google_apigee_instance` resource
3+
```

google/services/apigee/resource_apigee_instance.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ in the format 'organizations/{{org_name}}'.`,
9898
"access_logging_config": {
9999
Type: schema.TypeList,
100100
Optional: true,
101+
ForceNew: true,
101102
Description: `Access logging configuration enables the access logging feature at the instance.
102103
Apigee customers can enable access logging to ship the access logs to their own project's cloud logging.`,
103104
MaxItems: 1,
@@ -106,11 +107,13 @@ Apigee customers can enable access logging to ship the access logs to their own
106107
"enabled": {
107108
Type: schema.TypeBool,
108109
Required: true,
110+
ForceNew: true,
109111
Description: `Boolean flag that specifies whether the customer access log feature is enabled.`,
110112
},
111113
"filter": {
112114
Type: schema.TypeString,
113115
Optional: true,
116+
ForceNew: true,
114117
Description: `Ship the access log entries that match the statusCode defined in the filter.
115118
The statusCode is the only expected/supported filter field. (Ex: statusCode)
116119
The filter will parse it to the Common Expression Language semantics for expression
@@ -400,12 +403,6 @@ func resourceApigeeInstanceUpdate(d *schema.ResourceData, meta interface{}) erro
400403
} else if v, ok := d.GetOkExists("consumer_accept_list"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, consumerAcceptListProp)) {
401404
obj["consumerAcceptList"] = consumerAcceptListProp
402405
}
403-
accessLoggingConfigProp, err := expandApigeeInstanceAccessLoggingConfig(d.Get("access_logging_config"), d, config)
404-
if err != nil {
405-
return err
406-
} else if v, ok := d.GetOkExists("access_logging_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, accessLoggingConfigProp)) {
407-
obj["accessLoggingConfig"] = accessLoggingConfigProp
408-
}
409406

410407
lockName, err := tpgresource.ReplaceVars(d, config, "{{org_id}}/apigeeInstances")
411408
if err != nil {
@@ -426,10 +423,6 @@ func resourceApigeeInstanceUpdate(d *schema.ResourceData, meta interface{}) erro
426423
if d.HasChange("consumer_accept_list") {
427424
updateMask = append(updateMask, "consumerAcceptList")
428425
}
429-
430-
if d.HasChange("access_logging_config") {
431-
updateMask = append(updateMask, "accessLoggingConfig")
432-
}
433426
// updateMask is a URL parameter but not present in the schema, so ReplaceVars
434427
// won't set it
435428
url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")})

google/services/apigee/resource_apigee_instance_update_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ resource "google_apigee_instance" "apigee_instance" {
227227
]
228228
229229
access_logging_config {
230-
enabled = true
231-
filter = "status_code >= 200 && status_code < 300"
230+
enabled = false
231+
filter = "status_code >= 0 && status_code < 600"
232232
}
233233
}
234234
`, context)

0 commit comments

Comments
 (0)