@@ -38,7 +38,7 @@ import (
3838 transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
3939)
4040
41- func DataConnectorEntitiesParamsDiffSuppress (k , old , new string , d * schema.ResourceData ) bool {
41+ func DataConnectorEntitiesFieldsDiffSuppress (k , old , new string , d * schema.ResourceData ) bool {
4242 return (old == "" && new == "{}" ) || (old == "{}" && new == "" )
4343}
4444
@@ -134,21 +134,22 @@ sync will be disabled.`,
134134 "entities" : {
135135 Type : schema .TypeList ,
136136 Optional : true ,
137- ForceNew : true ,
138137 Description : `List of entities from the connected data source to ingest.` ,
139138 Elem : & schema.Resource {
140139 Schema : map [string ]* schema.Schema {
141140 "entity_name" : {
142141 Type : schema .TypeString ,
143142 Optional : true ,
143+ ForceNew : true ,
144144 Description : `The name of the entity. Supported values by data source:
145145* Salesforce: 'Lead', 'Opportunity', 'Contact', 'Account', 'Case', 'Contract', 'Campaign'
146146* Jira: project, issue, attachment, comment, worklog
147147* Confluence: 'Content', 'Space'` ,
148148 },
149149 "key_property_mappings" : {
150- Type : schema .TypeMap ,
151- Optional : true ,
150+ Type : schema .TypeMap ,
151+ Optional : true ,
152+ DiffSuppressFunc : DataConnectorEntitiesFieldsDiffSuppress ,
152153 Description : `Attributes for indexing.
153154Key: Field name.
154155Value: The key property to map a field to, such as 'title', and
@@ -163,7 +164,7 @@ Value: The key property to map a field to, such as 'title', and
163164 Type : schema .TypeString ,
164165 Optional : true ,
165166 ValidateFunc : validation .StringIsJSON ,
166- DiffSuppressFunc : DataConnectorEntitiesParamsDiffSuppress ,
167+ DiffSuppressFunc : DataConnectorEntitiesFieldsDiffSuppress ,
167168 StateFunc : func (v interface {}) string { s , _ := structure .NormalizeJsonString (v ); return s },
168169 Description : `The parameters for the entity to facilitate data ingestion.` ,
169170 },
@@ -623,6 +624,12 @@ func resourceDiscoveryEngineDataConnectorUpdate(d *schema.ResourceData, meta int
623624 } else if v , ok := d .GetOkExists ("refresh_interval" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , refreshIntervalProp )) {
624625 obj ["refreshInterval" ] = refreshIntervalProp
625626 }
627+ entitiesProp , err := expandDiscoveryEngineDataConnectorEntities (d .Get ("entities" ), d , config )
628+ if err != nil {
629+ return err
630+ } else if v , ok := d .GetOkExists ("entities" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , entitiesProp )) {
631+ obj ["entities" ] = entitiesProp
632+ }
626633 connectorModesProp , err := expandDiscoveryEngineDataConnectorConnectorModes (d .Get ("connector_modes" ), d , config )
627634 if err != nil {
628635 return err
@@ -675,6 +682,11 @@ func resourceDiscoveryEngineDataConnectorUpdate(d *schema.ResourceData, meta int
675682 updateMask = append (updateMask , "refreshInterval" )
676683 }
677684
685+ if d .HasChange ("entities" ) {
686+ updateMask = append (updateMask , "entities.params" ,
687+ "entities.keyPropertyMappings" )
688+ }
689+
678690 if d .HasChange ("connector_modes" ) {
679691 updateMask = append (updateMask , "connectorModes" )
680692 }
0 commit comments