@@ -79,7 +79,7 @@ func ResourceClouddeployTarget() *schema.Resource {
79
79
Description : "Information specifying an Anthos Cluster." ,
80
80
MaxItems : 1 ,
81
81
Elem : ClouddeployTargetAnthosClusterSchema (),
82
- ConflictsWith : []string {"gke" , "run" },
82
+ ConflictsWith : []string {"gke" , "run" , "multi_target" },
83
83
},
84
84
85
85
"deploy_parameters" : {
@@ -109,7 +109,7 @@ func ResourceClouddeployTarget() *schema.Resource {
109
109
Description : "Information specifying a GKE Cluster." ,
110
110
MaxItems : 1 ,
111
111
Elem : ClouddeployTargetGkeSchema (),
112
- ConflictsWith : []string {"anthos_cluster" , "run" },
112
+ ConflictsWith : []string {"anthos_cluster" , "run" , "multi_target" },
113
113
},
114
114
115
115
"labels" : {
@@ -119,6 +119,15 @@ func ResourceClouddeployTarget() *schema.Resource {
119
119
Elem : & schema.Schema {Type : schema .TypeString },
120
120
},
121
121
122
+ "multi_target" : {
123
+ Type : schema .TypeList ,
124
+ Optional : true ,
125
+ Description : "Information specifying a multiTarget." ,
126
+ MaxItems : 1 ,
127
+ Elem : ClouddeployTargetMultiTargetSchema (),
128
+ ConflictsWith : []string {"gke" , "anthos_cluster" , "run" },
129
+ },
130
+
122
131
"project" : {
123
132
Type : schema .TypeString ,
124
133
Computed : true ,
@@ -140,7 +149,7 @@ func ResourceClouddeployTarget() *schema.Resource {
140
149
Description : "Information specifying a Cloud Run deployment target." ,
141
150
MaxItems : 1 ,
142
151
Elem : ClouddeployTargetRunSchema (),
143
- ConflictsWith : []string {"gke" , "anthos_cluster" },
152
+ ConflictsWith : []string {"gke" , "anthos_cluster" , "multi_target" },
144
153
},
145
154
146
155
"create_time" : {
@@ -249,6 +258,19 @@ func ClouddeployTargetGkeSchema() *schema.Resource {
249
258
}
250
259
}
251
260
261
+ func ClouddeployTargetMultiTargetSchema () * schema.Resource {
262
+ return & schema.Resource {
263
+ Schema : map [string ]* schema.Schema {
264
+ "target_ids" : {
265
+ Type : schema .TypeList ,
266
+ Required : true ,
267
+ Description : "Required. The target_ids of this multiTarget." ,
268
+ Elem : & schema.Schema {Type : schema .TypeString },
269
+ },
270
+ },
271
+ }
272
+ }
273
+
252
274
func ClouddeployTargetRunSchema () * schema.Resource {
253
275
return & schema.Resource {
254
276
Schema : map [string ]* schema.Schema {
@@ -278,6 +300,7 @@ func resourceClouddeployTargetCreate(d *schema.ResourceData, meta interface{}) e
278
300
ExecutionConfigs : expandClouddeployTargetExecutionConfigsArray (d .Get ("execution_configs" )),
279
301
Gke : expandClouddeployTargetGke (d .Get ("gke" )),
280
302
Labels : tpgresource .CheckStringMap (d .Get ("labels" )),
303
+ MultiTarget : expandClouddeployTargetMultiTarget (d .Get ("multi_target" )),
281
304
Project : dcl .String (project ),
282
305
RequireApproval : dcl .Bool (d .Get ("require_approval" ).(bool )),
283
306
Run : expandClouddeployTargetRun (d .Get ("run" )),
@@ -337,6 +360,7 @@ func resourceClouddeployTargetRead(d *schema.ResourceData, meta interface{}) err
337
360
ExecutionConfigs : expandClouddeployTargetExecutionConfigsArray (d .Get ("execution_configs" )),
338
361
Gke : expandClouddeployTargetGke (d .Get ("gke" )),
339
362
Labels : tpgresource .CheckStringMap (d .Get ("labels" )),
363
+ MultiTarget : expandClouddeployTargetMultiTarget (d .Get ("multi_target" )),
340
364
Project : dcl .String (project ),
341
365
RequireApproval : dcl .Bool (d .Get ("require_approval" ).(bool )),
342
366
Run : expandClouddeployTargetRun (d .Get ("run" )),
@@ -391,6 +415,9 @@ func resourceClouddeployTargetRead(d *schema.ResourceData, meta interface{}) err
391
415
if err = d .Set ("labels" , res .Labels ); err != nil {
392
416
return fmt .Errorf ("error setting labels in state: %s" , err )
393
417
}
418
+ if err = d .Set ("multi_target" , flattenClouddeployTargetMultiTarget (res .MultiTarget )); err != nil {
419
+ return fmt .Errorf ("error setting multi_target in state: %s" , err )
420
+ }
394
421
if err = d .Set ("project" , res .Project ); err != nil {
395
422
return fmt .Errorf ("error setting project in state: %s" , err )
396
423
}
@@ -435,6 +462,7 @@ func resourceClouddeployTargetUpdate(d *schema.ResourceData, meta interface{}) e
435
462
ExecutionConfigs : expandClouddeployTargetExecutionConfigsArray (d .Get ("execution_configs" )),
436
463
Gke : expandClouddeployTargetGke (d .Get ("gke" )),
437
464
Labels : tpgresource .CheckStringMap (d .Get ("labels" )),
465
+ MultiTarget : expandClouddeployTargetMultiTarget (d .Get ("multi_target" )),
438
466
Project : dcl .String (project ),
439
467
RequireApproval : dcl .Bool (d .Get ("require_approval" ).(bool )),
440
468
Run : expandClouddeployTargetRun (d .Get ("run" )),
@@ -489,6 +517,7 @@ func resourceClouddeployTargetDelete(d *schema.ResourceData, meta interface{}) e
489
517
ExecutionConfigs : expandClouddeployTargetExecutionConfigsArray (d .Get ("execution_configs" )),
490
518
Gke : expandClouddeployTargetGke (d .Get ("gke" )),
491
519
Labels : tpgresource .CheckStringMap (d .Get ("labels" )),
520
+ MultiTarget : expandClouddeployTargetMultiTarget (d .Get ("multi_target" )),
492
521
Project : dcl .String (project ),
493
522
RequireApproval : dcl .Bool (d .Get ("require_approval" ).(bool )),
494
523
Run : expandClouddeployTargetRun (d .Get ("run" )),
@@ -657,6 +686,32 @@ func flattenClouddeployTargetGke(obj *clouddeploy.TargetGke) interface{} {
657
686
658
687
}
659
688
689
+ func expandClouddeployTargetMultiTarget (o interface {}) * clouddeploy.TargetMultiTarget {
690
+ if o == nil {
691
+ return clouddeploy .EmptyTargetMultiTarget
692
+ }
693
+ objArr := o .([]interface {})
694
+ if len (objArr ) == 0 || objArr [0 ] == nil {
695
+ return clouddeploy .EmptyTargetMultiTarget
696
+ }
697
+ obj := objArr [0 ].(map [string ]interface {})
698
+ return & clouddeploy.TargetMultiTarget {
699
+ TargetIds : tpgdclresource .ExpandStringArray (obj ["target_ids" ]),
700
+ }
701
+ }
702
+
703
+ func flattenClouddeployTargetMultiTarget (obj * clouddeploy.TargetMultiTarget ) interface {} {
704
+ if obj == nil || obj .Empty () {
705
+ return nil
706
+ }
707
+ transformed := map [string ]interface {}{
708
+ "target_ids" : obj .TargetIds ,
709
+ }
710
+
711
+ return []interface {}{transformed }
712
+
713
+ }
714
+
660
715
func expandClouddeployTargetRun (o interface {}) * clouddeploy.TargetRun {
661
716
if o == nil {
662
717
return clouddeploy .EmptyTargetRun
0 commit comments