Skip to content

Commit 87fe305

Browse files
authored
make connector entities mutable (#15390)
1 parent 605d715 commit 87fe305

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

mmv1/products/discoveryengine/DataConnector.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,14 @@ properties:
136136
type: Array
137137
description: |
138138
List of entities from the connected data source to ingest.
139-
immutable: true
139+
update_mask_fields:
140+
- 'entities.params'
141+
- 'entities.keyPropertyMappings'
140142
item_type:
141143
type: NestedObject
142144
properties:
143145
- name: 'entityName'
146+
immutable: true
144147
type: String
145148
description: |
146149
The name of the entity. Supported values by data source:
@@ -149,6 +152,7 @@ properties:
149152
* Confluence: `Content`, `Space`
150153
- name: 'keyPropertyMappings'
151154
type: KeyValuePairs
155+
diff_suppress_func: 'DataConnectorEntitiesFieldsDiffSuppress'
152156
description: |
153157
Attributes for indexing.
154158
Key: Field name.
@@ -169,7 +173,7 @@ properties:
169173
output: true
170174
- name: 'params'
171175
description: 'The parameters for the entity to facilitate data ingestion.'
172-
diff_suppress_func: 'DataConnectorEntitiesParamsDiffSuppress'
176+
diff_suppress_func: 'DataConnectorEntitiesFieldsDiffSuppress'
173177
custom_flatten: 'templates/terraform/custom_flatten/json_schema.tmpl'
174178
custom_expand: 'templates/terraform/custom_expand/json_schema.tmpl'
175179
state_func: 'func(v interface{}) string { s, _ := structure.NormalizeJsonString(v); return s }'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
func DataConnectorEntitiesParamsDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
1+
func DataConnectorEntitiesFieldsDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
22
return (old == "" && new == "{}") || (old == "{}" && new == "")
33
}

mmv1/third_party/terraform/services/discoveryengine/resource_discovery_engine_data_connector_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ resource "google_discovery_engine_data_connector" "servicenow-basic" {
126126
params = jsonencode({
127127
"inclusion_filters": {
128128
"knowledgeBaseSysId": [
129-
"123"
129+
"456"
130130
]
131131
}
132132
})
@@ -136,7 +136,7 @@ resource "google_discovery_engine_data_connector" "servicenow-basic" {
136136
params = jsonencode({
137137
"inclusion_filters": {
138138
"knowledgeBaseSysId": [
139-
"123"
139+
"456"
140140
]
141141
}
142142
})
@@ -146,7 +146,7 @@ resource "google_discovery_engine_data_connector" "servicenow-basic" {
146146
params = jsonencode({
147147
"inclusion_filters": {
148148
"knowledgeBaseSysId": [
149-
"123"
149+
"456"
150150
]
151151
}
152152
})
@@ -184,7 +184,7 @@ func TestAccDiscoveryEngineDataConnector_DataConnectorEntitiesParamsDiffSuppress
184184
}
185185

186186
for tn, tc := range cases {
187-
if discoveryengine.DataConnectorEntitiesParamsDiffSuppress("entities_params_diff_supress", tc.Old, tc.New, nil) != tc.ExpectDiffSuppress {
187+
if discoveryengine.DataConnectorEntitiesFieldsDiffSuppress("entities_params_diff_supress", tc.Old, tc.New, nil) != tc.ExpectDiffSuppress {
188188
t.Errorf("bad: %s, %q => %q expect DiffSuppress to return %t", tn, tc.Old, tc.New, tc.ExpectDiffSuppress)
189189
}
190190
}

0 commit comments

Comments
 (0)