@@ -20,6 +20,7 @@ package integrations
20
20
import (
21
21
"fmt"
22
22
"log"
23
+ "reflect"
23
24
"time"
24
25
25
26
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff"
@@ -143,6 +144,30 @@ func resourceIntegrationsClientCreate(d *schema.ResourceData, meta interface{})
143
144
}
144
145
145
146
obj := make (map [string ]interface {})
147
+ cloudKmsConfigProp , err := expandIntegrationsClientCloudKmsConfig (d .Get ("cloud_kms_config" ), d , config )
148
+ if err != nil {
149
+ return err
150
+ } else if v , ok := d .GetOkExists ("cloud_kms_config" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (cloudKmsConfigProp )) && (ok || ! reflect .DeepEqual (v , cloudKmsConfigProp )) {
151
+ obj ["cloudKmsConfig" ] = cloudKmsConfigProp
152
+ }
153
+ createSampleWorkflowsProp , err := expandIntegrationsClientCreateSampleWorkflows (d .Get ("create_sample_workflows" ), d , config )
154
+ if err != nil {
155
+ return err
156
+ } else if v , ok := d .GetOkExists ("create_sample_workflows" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (createSampleWorkflowsProp )) && (ok || ! reflect .DeepEqual (v , createSampleWorkflowsProp )) {
157
+ obj ["createSampleWorkflows" ] = createSampleWorkflowsProp
158
+ }
159
+ provisionGmekProp , err := expandIntegrationsClientProvisionGmek (d .Get ("provision_gmek" ), d , config )
160
+ if err != nil {
161
+ return err
162
+ } else if v , ok := d .GetOkExists ("provision_gmek" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (provisionGmekProp )) && (ok || ! reflect .DeepEqual (v , provisionGmekProp )) {
163
+ obj ["provisionGmek" ] = provisionGmekProp
164
+ }
165
+ runAsServiceAccountProp , err := expandIntegrationsClientRunAsServiceAccount (d .Get ("run_as_service_account" ), d , config )
166
+ if err != nil {
167
+ return err
168
+ } else if v , ok := d .GetOkExists ("run_as_service_account" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (runAsServiceAccountProp )) && (ok || ! reflect .DeepEqual (v , runAsServiceAccountProp )) {
169
+ obj ["runAsServiceAccount" ] = runAsServiceAccountProp
170
+ }
146
171
147
172
lockName , err := tpgresource .ReplaceVars (d , config , "Client/{{location}}" )
148
173
if err != nil {
@@ -322,6 +347,85 @@ func resourceIntegrationsClientImport(d *schema.ResourceData, meta interface{})
322
347
return []* schema.ResourceData {d }, nil
323
348
}
324
349
350
+ func expandIntegrationsClientCloudKmsConfig (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
351
+ l := v .([]interface {})
352
+ if len (l ) == 0 || l [0 ] == nil {
353
+ return nil , nil
354
+ }
355
+ raw := l [0 ]
356
+ original := raw .(map [string ]interface {})
357
+ transformed := make (map [string ]interface {})
358
+
359
+ transformedKmsLocation , err := expandIntegrationsClientCloudKmsConfigKmsLocation (original ["kms_location" ], d , config )
360
+ if err != nil {
361
+ return nil , err
362
+ } else if val := reflect .ValueOf (transformedKmsLocation ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
363
+ transformed ["kmsLocation" ] = transformedKmsLocation
364
+ }
365
+
366
+ transformedKmsRing , err := expandIntegrationsClientCloudKmsConfigKmsRing (original ["kms_ring" ], d , config )
367
+ if err != nil {
368
+ return nil , err
369
+ } else if val := reflect .ValueOf (transformedKmsRing ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
370
+ transformed ["kmsRing" ] = transformedKmsRing
371
+ }
372
+
373
+ transformedKey , err := expandIntegrationsClientCloudKmsConfigKey (original ["key" ], d , config )
374
+ if err != nil {
375
+ return nil , err
376
+ } else if val := reflect .ValueOf (transformedKey ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
377
+ transformed ["key" ] = transformedKey
378
+ }
379
+
380
+ transformedKeyVersion , err := expandIntegrationsClientCloudKmsConfigKeyVersion (original ["key_version" ], d , config )
381
+ if err != nil {
382
+ return nil , err
383
+ } else if val := reflect .ValueOf (transformedKeyVersion ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
384
+ transformed ["keyVersion" ] = transformedKeyVersion
385
+ }
386
+
387
+ transformedKmsProjectId , err := expandIntegrationsClientCloudKmsConfigKmsProjectId (original ["kms_project_id" ], d , config )
388
+ if err != nil {
389
+ return nil , err
390
+ } else if val := reflect .ValueOf (transformedKmsProjectId ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
391
+ transformed ["kmsProjectId" ] = transformedKmsProjectId
392
+ }
393
+
394
+ return transformed , nil
395
+ }
396
+
397
+ func expandIntegrationsClientCloudKmsConfigKmsLocation (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
398
+ return v , nil
399
+ }
400
+
401
+ func expandIntegrationsClientCloudKmsConfigKmsRing (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
402
+ return v , nil
403
+ }
404
+
405
+ func expandIntegrationsClientCloudKmsConfigKey (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
406
+ return v , nil
407
+ }
408
+
409
+ func expandIntegrationsClientCloudKmsConfigKeyVersion (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
410
+ return v , nil
411
+ }
412
+
413
+ func expandIntegrationsClientCloudKmsConfigKmsProjectId (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
414
+ return v , nil
415
+ }
416
+
417
+ func expandIntegrationsClientCreateSampleWorkflows (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
418
+ return v , nil
419
+ }
420
+
421
+ func expandIntegrationsClientProvisionGmek (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
422
+ return v , nil
423
+ }
424
+
425
+ func expandIntegrationsClientRunAsServiceAccount (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
426
+ return v , nil
427
+ }
428
+
325
429
func resourceIntegrationsClientDecoder (d * schema.ResourceData , meta interface {}, res map [string ]interface {}) (map [string ]interface {}, error ) {
326
430
// Since Client resource doesnt have any properties,
327
431
// Adding this decoder as placeholder else the linter will
0 commit comments