Skip to content

Commit 41a39ce

Browse files
authored
Fix for desired_auto_created_endpoints incorrect update (#15720)
1 parent 78e89b5 commit 41a39ce

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

mmv1/products/memorystore/Instance.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ async:
4343
custom_code:
4444
encoder: 'templates/terraform/encoders/memorystore_instance.go.tmpl'
4545
decoder: 'templates/terraform/decoders/memorystore_instance.go.tmpl'
46+
constants: 'templates/terraform/constants/memorystore_instance.go.tmpl'
4647
examples:
4748
- name: 'memorystore_instance_basic'
4849
primary_resource_id: 'instance-basic'
@@ -134,6 +135,7 @@ virtual_fields:
134135
endpoints connections. "
135136
type: Array
136137
immutable: true
138+
diff_suppress_func: 'memorystoreInstancedDesiredAutoConnectionsDiffSuppress'
137139
conflicts:
138140
- desiredPscAutoConnections
139141
item_type:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
func memorystoreInstancedDesiredAutoConnectionsDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
3+
// Suppress diff wis to handle an edge case where desired_auto_created_endpoints in addtion to desired_psc_auto_connections are both set with same values
4+
// this is due to how the api reponds when mode is set to CLUSTER_DISABLED and desired_psc_auto_connections is set.
5+
log.Printf("[DEBUG] desired_auto_created_endpoints is set in state but not in config, supressing force new recreate")
6+
7+
oldAuto, newAuto := d.GetChange("desired_auto_created_endpoints")
8+
9+
if reflect.DeepEqual(oldAuto, newAuto) && !tpgresource.IsEmptyValue(reflect.ValueOf(oldAuto)) && !tpgresource.IsEmptyValue(reflect.ValueOf(newAuto)) {
10+
return true
11+
}
12+
13+
return false
14+
}

0 commit comments

Comments
 (0)