@@ -111,6 +111,15 @@ func ResourceContainerAwsCluster() *schema.Resource {
111
111
Elem : ContainerAwsClusterNetworkingSchema (),
112
112
},
113
113
114
+ "binary_authorization" : {
115
+ Type : schema .TypeList ,
116
+ Computed : true ,
117
+ Optional : true ,
118
+ Description : "Configuration options for the Binary Authorization feature." ,
119
+ MaxItems : 1 ,
120
+ Elem : ContainerAwsClusterBinaryAuthorizationSchema (),
121
+ },
122
+
114
123
"description" : {
115
124
Type : schema .TypeString ,
116
125
Optional : true ,
@@ -540,6 +549,19 @@ func ContainerAwsClusterNetworkingSchema() *schema.Resource {
540
549
}
541
550
}
542
551
552
+ func ContainerAwsClusterBinaryAuthorizationSchema () * schema.Resource {
553
+ return & schema.Resource {
554
+ Schema : map [string ]* schema.Schema {
555
+ "evaluation_mode" : {
556
+ Type : schema .TypeString ,
557
+ Computed : true ,
558
+ Optional : true ,
559
+ Description : "Mode of operation for Binary Authorization policy evaluation. Possible values: DISABLED, PROJECT_SINGLETON_POLICY_ENFORCE" ,
560
+ },
561
+ },
562
+ }
563
+ }
564
+
543
565
func ContainerAwsClusterWorkloadIdentityConfigSchema () * schema.Resource {
544
566
return & schema.Resource {
545
567
Schema : map [string ]* schema.Schema {
@@ -572,16 +594,17 @@ func resourceContainerAwsClusterCreate(d *schema.ResourceData, meta interface{})
572
594
}
573
595
574
596
obj := & containeraws.Cluster {
575
- Authorization : expandContainerAwsClusterAuthorization (d .Get ("authorization" )),
576
- AwsRegion : dcl .String (d .Get ("aws_region" ).(string )),
577
- ControlPlane : expandContainerAwsClusterControlPlane (d .Get ("control_plane" )),
578
- Fleet : expandContainerAwsClusterFleet (d .Get ("fleet" )),
579
- Location : dcl .String (d .Get ("location" ).(string )),
580
- Name : dcl .String (d .Get ("name" ).(string )),
581
- Networking : expandContainerAwsClusterNetworking (d .Get ("networking" )),
582
- Description : dcl .String (d .Get ("description" ).(string )),
583
- Annotations : tpgresource .CheckStringMap (d .Get ("effective_annotations" )),
584
- Project : dcl .String (project ),
597
+ Authorization : expandContainerAwsClusterAuthorization (d .Get ("authorization" )),
598
+ AwsRegion : dcl .String (d .Get ("aws_region" ).(string )),
599
+ ControlPlane : expandContainerAwsClusterControlPlane (d .Get ("control_plane" )),
600
+ Fleet : expandContainerAwsClusterFleet (d .Get ("fleet" )),
601
+ Location : dcl .String (d .Get ("location" ).(string )),
602
+ Name : dcl .String (d .Get ("name" ).(string )),
603
+ Networking : expandContainerAwsClusterNetworking (d .Get ("networking" )),
604
+ BinaryAuthorization : expandContainerAwsClusterBinaryAuthorization (d .Get ("binary_authorization" )),
605
+ Description : dcl .String (d .Get ("description" ).(string )),
606
+ Annotations : tpgresource .CheckStringMap (d .Get ("effective_annotations" )),
607
+ Project : dcl .String (project ),
585
608
}
586
609
587
610
id , err := obj .ID ()
@@ -629,16 +652,17 @@ func resourceContainerAwsClusterRead(d *schema.ResourceData, meta interface{}) e
629
652
}
630
653
631
654
obj := & containeraws.Cluster {
632
- Authorization : expandContainerAwsClusterAuthorization (d .Get ("authorization" )),
633
- AwsRegion : dcl .String (d .Get ("aws_region" ).(string )),
634
- ControlPlane : expandContainerAwsClusterControlPlane (d .Get ("control_plane" )),
635
- Fleet : expandContainerAwsClusterFleet (d .Get ("fleet" )),
636
- Location : dcl .String (d .Get ("location" ).(string )),
637
- Name : dcl .String (d .Get ("name" ).(string )),
638
- Networking : expandContainerAwsClusterNetworking (d .Get ("networking" )),
639
- Description : dcl .String (d .Get ("description" ).(string )),
640
- Annotations : tpgresource .CheckStringMap (d .Get ("effective_annotations" )),
641
- Project : dcl .String (project ),
655
+ Authorization : expandContainerAwsClusterAuthorization (d .Get ("authorization" )),
656
+ AwsRegion : dcl .String (d .Get ("aws_region" ).(string )),
657
+ ControlPlane : expandContainerAwsClusterControlPlane (d .Get ("control_plane" )),
658
+ Fleet : expandContainerAwsClusterFleet (d .Get ("fleet" )),
659
+ Location : dcl .String (d .Get ("location" ).(string )),
660
+ Name : dcl .String (d .Get ("name" ).(string )),
661
+ Networking : expandContainerAwsClusterNetworking (d .Get ("networking" )),
662
+ BinaryAuthorization : expandContainerAwsClusterBinaryAuthorization (d .Get ("binary_authorization" )),
663
+ Description : dcl .String (d .Get ("description" ).(string )),
664
+ Annotations : tpgresource .CheckStringMap (d .Get ("effective_annotations" )),
665
+ Project : dcl .String (project ),
642
666
}
643
667
644
668
userAgent , err := tpgresource .GenerateUserAgentString (d , config .UserAgent )
@@ -684,6 +708,9 @@ func resourceContainerAwsClusterRead(d *schema.ResourceData, meta interface{}) e
684
708
if err = d .Set ("networking" , flattenContainerAwsClusterNetworking (res .Networking )); err != nil {
685
709
return fmt .Errorf ("error setting networking in state: %s" , err )
686
710
}
711
+ if err = d .Set ("binary_authorization" , flattenContainerAwsClusterBinaryAuthorization (res .BinaryAuthorization )); err != nil {
712
+ return fmt .Errorf ("error setting binary_authorization in state: %s" , err )
713
+ }
687
714
if err = d .Set ("description" , res .Description ); err != nil {
688
715
return fmt .Errorf ("error setting description in state: %s" , err )
689
716
}
@@ -731,16 +758,17 @@ func resourceContainerAwsClusterUpdate(d *schema.ResourceData, meta interface{})
731
758
}
732
759
733
760
obj := & containeraws.Cluster {
734
- Authorization : expandContainerAwsClusterAuthorization (d .Get ("authorization" )),
735
- AwsRegion : dcl .String (d .Get ("aws_region" ).(string )),
736
- ControlPlane : expandContainerAwsClusterControlPlane (d .Get ("control_plane" )),
737
- Fleet : expandContainerAwsClusterFleet (d .Get ("fleet" )),
738
- Location : dcl .String (d .Get ("location" ).(string )),
739
- Name : dcl .String (d .Get ("name" ).(string )),
740
- Networking : expandContainerAwsClusterNetworking (d .Get ("networking" )),
741
- Description : dcl .String (d .Get ("description" ).(string )),
742
- Annotations : tpgresource .CheckStringMap (d .Get ("effective_annotations" )),
743
- Project : dcl .String (project ),
761
+ Authorization : expandContainerAwsClusterAuthorization (d .Get ("authorization" )),
762
+ AwsRegion : dcl .String (d .Get ("aws_region" ).(string )),
763
+ ControlPlane : expandContainerAwsClusterControlPlane (d .Get ("control_plane" )),
764
+ Fleet : expandContainerAwsClusterFleet (d .Get ("fleet" )),
765
+ Location : dcl .String (d .Get ("location" ).(string )),
766
+ Name : dcl .String (d .Get ("name" ).(string )),
767
+ Networking : expandContainerAwsClusterNetworking (d .Get ("networking" )),
768
+ BinaryAuthorization : expandContainerAwsClusterBinaryAuthorization (d .Get ("binary_authorization" )),
769
+ Description : dcl .String (d .Get ("description" ).(string )),
770
+ Annotations : tpgresource .CheckStringMap (d .Get ("effective_annotations" )),
771
+ Project : dcl .String (project ),
744
772
}
745
773
directive := tpgdclresource .UpdateDirective
746
774
userAgent , err := tpgresource .GenerateUserAgentString (d , config .UserAgent )
@@ -783,16 +811,17 @@ func resourceContainerAwsClusterDelete(d *schema.ResourceData, meta interface{})
783
811
}
784
812
785
813
obj := & containeraws.Cluster {
786
- Authorization : expandContainerAwsClusterAuthorization (d .Get ("authorization" )),
787
- AwsRegion : dcl .String (d .Get ("aws_region" ).(string )),
788
- ControlPlane : expandContainerAwsClusterControlPlane (d .Get ("control_plane" )),
789
- Fleet : expandContainerAwsClusterFleet (d .Get ("fleet" )),
790
- Location : dcl .String (d .Get ("location" ).(string )),
791
- Name : dcl .String (d .Get ("name" ).(string )),
792
- Networking : expandContainerAwsClusterNetworking (d .Get ("networking" )),
793
- Description : dcl .String (d .Get ("description" ).(string )),
794
- Annotations : tpgresource .CheckStringMap (d .Get ("effective_annotations" )),
795
- Project : dcl .String (project ),
814
+ Authorization : expandContainerAwsClusterAuthorization (d .Get ("authorization" )),
815
+ AwsRegion : dcl .String (d .Get ("aws_region" ).(string )),
816
+ ControlPlane : expandContainerAwsClusterControlPlane (d .Get ("control_plane" )),
817
+ Fleet : expandContainerAwsClusterFleet (d .Get ("fleet" )),
818
+ Location : dcl .String (d .Get ("location" ).(string )),
819
+ Name : dcl .String (d .Get ("name" ).(string )),
820
+ Networking : expandContainerAwsClusterNetworking (d .Get ("networking" )),
821
+ BinaryAuthorization : expandContainerAwsClusterBinaryAuthorization (d .Get ("binary_authorization" )),
822
+ Description : dcl .String (d .Get ("description" ).(string )),
823
+ Annotations : tpgresource .CheckStringMap (d .Get ("effective_annotations" )),
824
+ Project : dcl .String (project ),
796
825
}
797
826
798
827
log .Printf ("[DEBUG] Deleting Cluster %q" , d .Id ())
@@ -1233,6 +1262,32 @@ func flattenContainerAwsClusterNetworking(obj *containeraws.ClusterNetworking) i
1233
1262
1234
1263
}
1235
1264
1265
+ func expandContainerAwsClusterBinaryAuthorization (o interface {}) * containeraws.ClusterBinaryAuthorization {
1266
+ if o == nil {
1267
+ return nil
1268
+ }
1269
+ objArr := o .([]interface {})
1270
+ if len (objArr ) == 0 || objArr [0 ] == nil {
1271
+ return nil
1272
+ }
1273
+ obj := objArr [0 ].(map [string ]interface {})
1274
+ return & containeraws.ClusterBinaryAuthorization {
1275
+ EvaluationMode : containeraws .ClusterBinaryAuthorizationEvaluationModeEnumRef (obj ["evaluation_mode" ].(string )),
1276
+ }
1277
+ }
1278
+
1279
+ func flattenContainerAwsClusterBinaryAuthorization (obj * containeraws.ClusterBinaryAuthorization ) interface {} {
1280
+ if obj == nil || obj .Empty () {
1281
+ return nil
1282
+ }
1283
+ transformed := map [string ]interface {}{
1284
+ "evaluation_mode" : obj .EvaluationMode ,
1285
+ }
1286
+
1287
+ return []interface {}{transformed }
1288
+
1289
+ }
1290
+
1236
1291
func flattenContainerAwsClusterWorkloadIdentityConfig (obj * containeraws.ClusterWorkloadIdentityConfig ) interface {} {
1237
1292
if obj == nil || obj .Empty () {
1238
1293
return nil
0 commit comments