Skip to content

Commit a6a19fd

Browse files
Upgrade to DCL Version 1.37.0 (#7619) (#14249)
* DCL release 1.37.0 * Fix make lint problem * Add tests for clouddeploy pipeline * Update tests for delivery_pipeline * Change delivery pipeline test name to avoid duplicated test name * Fix {{resource}} not found issue * Add tests for clouddeploy delivery pipeline Signed-off-by: Modular Magician <[email protected]>
1 parent a8b8d92 commit a6a19fd

9 files changed

+409
-9
lines changed

.changelog/7619.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
clouddeploy: added fields for resource `google_clouddeploy_delivery_pipeline`
3+
```

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ go 1.19
33

44
require (
55
cloud.google.com/go/bigtable v1.17.0
6-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.34.0
6+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.37.0
77
github.com/apparentlymart/go-cidr v1.1.0
88
github.com/davecgh/go-spew v1.1.1
99
github.com/dnaeon/go-vcr v1.0.1

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9
4747
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
4848
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
4949
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
50-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.34.0 h1:o7t+hPFv+Ax5O2vxzIH7dEtvlWA7JJOlOd7mWFvMa6s=
51-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.34.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k=
50+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.37.0 h1:lTD1OrEwktUJDTZopou9HXXiVDcKQ3f0s7/P0wsgw3M=
51+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.37.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k=
5252
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
5353
github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk=
5454
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=

google/resource_assured_workloads_workload.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func ResourceAssuredWorkloadsWorkload() *schema.Resource {
5757
Type: schema.TypeString,
5858
Required: true,
5959
ForceNew: true,
60-
Description: "Required. Immutable. Compliance Regime associated with this workload. Possible values: COMPLIANCE_REGIME_UNSPECIFIED, IL4, CJIS, FEDRAMP_HIGH, FEDRAMP_MODERATE, US_REGIONAL_ACCESS",
60+
Description: "Required. Immutable. Compliance Regime associated with this workload. Possible values: COMPLIANCE_REGIME_UNSPECIFIED, IL4, CJIS, FEDRAMP_HIGH, FEDRAMP_MODERATE, US_REGIONAL_ACCESS, HIPAA, EU_REGIONS_AND_SUPPORT, CA_REGIONS_AND_SUPPORT, ITAR, AU_REGIONS_AND_US_SUPPORT, ASSURED_WORKLOADS_FOR_PARTNERS",
6161
},
6262

6363
"display_name": {

google/resource_clouddeploy_delivery_pipeline.go

+127
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ func ClouddeployDeliveryPipelineSerialPipelineStagesSchema() *schema.Resource {
159159
Elem: &schema.Schema{Type: schema.TypeString},
160160
},
161161

162+
"strategy": {
163+
Type: schema.TypeList,
164+
Optional: true,
165+
Description: "Optional. The strategy to use for a `Rollout` to this stage.",
166+
MaxItems: 1,
167+
Elem: ClouddeployDeliveryPipelineSerialPipelineStagesStrategySchema(),
168+
},
169+
162170
"target_id": {
163171
Type: schema.TypeString,
164172
Optional: true,
@@ -168,6 +176,32 @@ func ClouddeployDeliveryPipelineSerialPipelineStagesSchema() *schema.Resource {
168176
}
169177
}
170178

179+
func ClouddeployDeliveryPipelineSerialPipelineStagesStrategySchema() *schema.Resource {
180+
return &schema.Resource{
181+
Schema: map[string]*schema.Schema{
182+
"standard": {
183+
Type: schema.TypeList,
184+
Optional: true,
185+
Description: "Standard deployment strategy executes a single deploy and allows verifying the deployment.",
186+
MaxItems: 1,
187+
Elem: ClouddeployDeliveryPipelineSerialPipelineStagesStrategyStandardSchema(),
188+
},
189+
},
190+
}
191+
}
192+
193+
func ClouddeployDeliveryPipelineSerialPipelineStagesStrategyStandardSchema() *schema.Resource {
194+
return &schema.Resource{
195+
Schema: map[string]*schema.Schema{
196+
"verify": {
197+
Type: schema.TypeBool,
198+
Optional: true,
199+
Description: "Whether to verify a deployment.",
200+
},
201+
},
202+
}
203+
}
204+
171205
func ClouddeployDeliveryPipelineConditionSchema() *schema.Resource {
172206
return &schema.Resource{
173207
Schema: map[string]*schema.Schema{
@@ -184,6 +218,13 @@ func ClouddeployDeliveryPipelineConditionSchema() *schema.Resource {
184218
Description: "Details around targets enumerated in the pipeline.",
185219
Elem: ClouddeployDeliveryPipelineConditionTargetsPresentConditionSchema(),
186220
},
221+
222+
"targets_type_condition": {
223+
Type: schema.TypeList,
224+
Computed: true,
225+
Description: "Details on the whether the targets enumerated in the pipeline are of the same type.",
226+
Elem: ClouddeployDeliveryPipelineConditionTargetsTypeConditionSchema(),
227+
},
187228
},
188229
}
189230
}
@@ -231,6 +272,24 @@ func ClouddeployDeliveryPipelineConditionTargetsPresentConditionSchema() *schema
231272
}
232273
}
233274

275+
func ClouddeployDeliveryPipelineConditionTargetsTypeConditionSchema() *schema.Resource {
276+
return &schema.Resource{
277+
Schema: map[string]*schema.Schema{
278+
"error_details": {
279+
Type: schema.TypeString,
280+
Computed: true,
281+
Description: "Human readable error message.",
282+
},
283+
284+
"status": {
285+
Type: schema.TypeBool,
286+
Computed: true,
287+
Description: "True if the targets are all a comparable type. For example this is true if all targets are GKE clusters. This is false if some targets are Cloud Run targets and others are GKE clusters.",
288+
},
289+
},
290+
}
291+
}
292+
234293
func resourceClouddeployDeliveryPipelineCreate(d *schema.ResourceData, meta interface{}) error {
235294
config := meta.(*Config)
236295
project, err := getProject(d, config)
@@ -534,6 +593,7 @@ func expandClouddeployDeliveryPipelineSerialPipelineStages(o interface{}) *cloud
534593
obj := o.(map[string]interface{})
535594
return &clouddeploy.DeliveryPipelineSerialPipelineStages{
536595
Profiles: expandStringArray(obj["profiles"]),
596+
Strategy: expandClouddeployDeliveryPipelineSerialPipelineStagesStrategy(obj["strategy"]),
537597
TargetId: dcl.String(obj["target_id"].(string)),
538598
}
539599
}
@@ -558,20 +618,74 @@ func flattenClouddeployDeliveryPipelineSerialPipelineStages(obj *clouddeploy.Del
558618
}
559619
transformed := map[string]interface{}{
560620
"profiles": obj.Profiles,
621+
"strategy": flattenClouddeployDeliveryPipelineSerialPipelineStagesStrategy(obj.Strategy),
561622
"target_id": obj.TargetId,
562623
}
563624

564625
return transformed
565626

566627
}
567628

629+
func expandClouddeployDeliveryPipelineSerialPipelineStagesStrategy(o interface{}) *clouddeploy.DeliveryPipelineSerialPipelineStagesStrategy {
630+
if o == nil {
631+
return clouddeploy.EmptyDeliveryPipelineSerialPipelineStagesStrategy
632+
}
633+
objArr := o.([]interface{})
634+
if len(objArr) == 0 || objArr[0] == nil {
635+
return clouddeploy.EmptyDeliveryPipelineSerialPipelineStagesStrategy
636+
}
637+
obj := objArr[0].(map[string]interface{})
638+
return &clouddeploy.DeliveryPipelineSerialPipelineStagesStrategy{
639+
Standard: expandClouddeployDeliveryPipelineSerialPipelineStagesStrategyStandard(obj["standard"]),
640+
}
641+
}
642+
643+
func flattenClouddeployDeliveryPipelineSerialPipelineStagesStrategy(obj *clouddeploy.DeliveryPipelineSerialPipelineStagesStrategy) interface{} {
644+
if obj == nil || obj.Empty() {
645+
return nil
646+
}
647+
transformed := map[string]interface{}{
648+
"standard": flattenClouddeployDeliveryPipelineSerialPipelineStagesStrategyStandard(obj.Standard),
649+
}
650+
651+
return []interface{}{transformed}
652+
653+
}
654+
655+
func expandClouddeployDeliveryPipelineSerialPipelineStagesStrategyStandard(o interface{}) *clouddeploy.DeliveryPipelineSerialPipelineStagesStrategyStandard {
656+
if o == nil {
657+
return clouddeploy.EmptyDeliveryPipelineSerialPipelineStagesStrategyStandard
658+
}
659+
objArr := o.([]interface{})
660+
if len(objArr) == 0 || objArr[0] == nil {
661+
return clouddeploy.EmptyDeliveryPipelineSerialPipelineStagesStrategyStandard
662+
}
663+
obj := objArr[0].(map[string]interface{})
664+
return &clouddeploy.DeliveryPipelineSerialPipelineStagesStrategyStandard{
665+
Verify: dcl.Bool(obj["verify"].(bool)),
666+
}
667+
}
668+
669+
func flattenClouddeployDeliveryPipelineSerialPipelineStagesStrategyStandard(obj *clouddeploy.DeliveryPipelineSerialPipelineStagesStrategyStandard) interface{} {
670+
if obj == nil || obj.Empty() {
671+
return nil
672+
}
673+
transformed := map[string]interface{}{
674+
"verify": obj.Verify,
675+
}
676+
677+
return []interface{}{transformed}
678+
679+
}
680+
568681
func flattenClouddeployDeliveryPipelineCondition(obj *clouddeploy.DeliveryPipelineCondition) interface{} {
569682
if obj == nil || obj.Empty() {
570683
return nil
571684
}
572685
transformed := map[string]interface{}{
573686
"pipeline_ready_condition": flattenClouddeployDeliveryPipelineConditionPipelineReadyCondition(obj.PipelineReadyCondition),
574687
"targets_present_condition": flattenClouddeployDeliveryPipelineConditionTargetsPresentCondition(obj.TargetsPresentCondition),
688+
"targets_type_condition": flattenClouddeployDeliveryPipelineConditionTargetsTypeCondition(obj.TargetsTypeCondition),
575689
}
576690

577691
return []interface{}{transformed}
@@ -604,3 +718,16 @@ func flattenClouddeployDeliveryPipelineConditionTargetsPresentCondition(obj *clo
604718
return []interface{}{transformed}
605719

606720
}
721+
722+
func flattenClouddeployDeliveryPipelineConditionTargetsTypeCondition(obj *clouddeploy.DeliveryPipelineConditionTargetsTypeCondition) interface{} {
723+
if obj == nil || obj.Empty() {
724+
return nil
725+
}
726+
transformed := map[string]interface{}{
727+
"error_details": obj.ErrorDetails,
728+
"status": obj.Status,
729+
}
730+
731+
return []interface{}{transformed}
732+
733+
}

google/resource_clouddeploy_target.go

+56-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func ResourceClouddeployTarget() *schema.Resource {
7272
Description: "Information specifying an Anthos Cluster.",
7373
MaxItems: 1,
7474
Elem: ClouddeployTargetAnthosClusterSchema(),
75-
ConflictsWith: []string{"gke"},
75+
ConflictsWith: []string{"gke", "run"},
7676
},
7777

7878
"description": {
@@ -95,7 +95,7 @@ func ResourceClouddeployTarget() *schema.Resource {
9595
Description: "Information specifying a GKE Cluster.",
9696
MaxItems: 1,
9797
Elem: ClouddeployTargetGkeSchema(),
98-
ConflictsWith: []string{"anthos_cluster"},
98+
ConflictsWith: []string{"anthos_cluster", "run"},
9999
},
100100

101101
"labels": {
@@ -120,6 +120,15 @@ func ResourceClouddeployTarget() *schema.Resource {
120120
Description: "Optional. Whether or not the `Target` requires approval.",
121121
},
122122

123+
"run": {
124+
Type: schema.TypeList,
125+
Optional: true,
126+
Description: "Information specifying a Cloud Run deployment target.",
127+
MaxItems: 1,
128+
Elem: ClouddeployTargetRunSchema(),
129+
ConflictsWith: []string{"gke", "anthos_cluster"},
130+
},
131+
123132
"create_time": {
124133
Type: schema.TypeString,
125134
Computed: true,
@@ -226,6 +235,18 @@ func ClouddeployTargetGkeSchema() *schema.Resource {
226235
}
227236
}
228237

238+
func ClouddeployTargetRunSchema() *schema.Resource {
239+
return &schema.Resource{
240+
Schema: map[string]*schema.Schema{
241+
"location": {
242+
Type: schema.TypeString,
243+
Required: true,
244+
Description: "Required. The location where the Cloud Run Service should be located. Format is `projects/{project}/locations/{location}`.",
245+
},
246+
},
247+
}
248+
}
249+
229250
func resourceClouddeployTargetCreate(d *schema.ResourceData, meta interface{}) error {
230251
config := meta.(*Config)
231252
project, err := getProject(d, config)
@@ -244,6 +265,7 @@ func resourceClouddeployTargetCreate(d *schema.ResourceData, meta interface{}) e
244265
Labels: checkStringMap(d.Get("labels")),
245266
Project: dcl.String(project),
246267
RequireApproval: dcl.Bool(d.Get("require_approval").(bool)),
268+
Run: expandClouddeployTargetRun(d.Get("run")),
247269
}
248270

249271
id, err := obj.ID()
@@ -301,6 +323,7 @@ func resourceClouddeployTargetRead(d *schema.ResourceData, meta interface{}) err
301323
Labels: checkStringMap(d.Get("labels")),
302324
Project: dcl.String(project),
303325
RequireApproval: dcl.Bool(d.Get("require_approval").(bool)),
326+
Run: expandClouddeployTargetRun(d.Get("run")),
304327
}
305328

306329
userAgent, err := generateUserAgentString(d, config.UserAgent)
@@ -355,6 +378,9 @@ func resourceClouddeployTargetRead(d *schema.ResourceData, meta interface{}) err
355378
if err = d.Set("require_approval", res.RequireApproval); err != nil {
356379
return fmt.Errorf("error setting require_approval in state: %s", err)
357380
}
381+
if err = d.Set("run", flattenClouddeployTargetRun(res.Run)); err != nil {
382+
return fmt.Errorf("error setting run in state: %s", err)
383+
}
358384
if err = d.Set("create_time", res.CreateTime); err != nil {
359385
return fmt.Errorf("error setting create_time in state: %s", err)
360386
}
@@ -391,6 +417,7 @@ func resourceClouddeployTargetUpdate(d *schema.ResourceData, meta interface{}) e
391417
Labels: checkStringMap(d.Get("labels")),
392418
Project: dcl.String(project),
393419
RequireApproval: dcl.Bool(d.Get("require_approval").(bool)),
420+
Run: expandClouddeployTargetRun(d.Get("run")),
394421
}
395422
directive := UpdateDirective
396423
userAgent, err := generateUserAgentString(d, config.UserAgent)
@@ -443,6 +470,7 @@ func resourceClouddeployTargetDelete(d *schema.ResourceData, meta interface{}) e
443470
Labels: checkStringMap(d.Get("labels")),
444471
Project: dcl.String(project),
445472
RequireApproval: dcl.Bool(d.Get("require_approval").(bool)),
473+
Run: expandClouddeployTargetRun(d.Get("run")),
446474
}
447475

448476
log.Printf("[DEBUG] Deleting Target %q", d.Id())
@@ -606,6 +634,32 @@ func flattenClouddeployTargetGke(obj *clouddeploy.TargetGke) interface{} {
606634

607635
return []interface{}{transformed}
608636

637+
}
638+
639+
func expandClouddeployTargetRun(o interface{}) *clouddeploy.TargetRun {
640+
if o == nil {
641+
return clouddeploy.EmptyTargetRun
642+
}
643+
objArr := o.([]interface{})
644+
if len(objArr) == 0 || objArr[0] == nil {
645+
return clouddeploy.EmptyTargetRun
646+
}
647+
obj := objArr[0].(map[string]interface{})
648+
return &clouddeploy.TargetRun{
649+
Location: dcl.String(obj["location"].(string)),
650+
}
651+
}
652+
653+
func flattenClouddeployTargetRun(obj *clouddeploy.TargetRun) interface{} {
654+
if obj == nil || obj.Empty() {
655+
return nil
656+
}
657+
transformed := map[string]interface{}{
658+
"location": obj.Location,
659+
}
660+
661+
return []interface{}{transformed}
662+
609663
}
610664
func flattenClouddeployTargetExecutionConfigsUsagesArray(obj []clouddeploy.TargetExecutionConfigsUsagesEnum) interface{} {
611665
if obj == nil {

website/docs/r/assured_workloads_workload.html.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ The following arguments are supported:
7070

7171
* `compliance_regime` -
7272
(Required)
73-
Required. Immutable. Compliance Regime associated with this workload. Possible values: COMPLIANCE_REGIME_UNSPECIFIED, IL4, CJIS, FEDRAMP_HIGH, FEDRAMP_MODERATE, US_REGIONAL_ACCESS
73+
Required. Immutable. Compliance Regime associated with this workload. Possible values: COMPLIANCE_REGIME_UNSPECIFIED, IL4, CJIS, FEDRAMP_HIGH, FEDRAMP_MODERATE, US_REGIONAL_ACCESS, HIPAA, EU_REGIONS_AND_SUPPORT, CA_REGIONS_AND_SUPPORT, ITAR, AU_REGIONS_AND_US_SUPPORT, ASSURED_WORKLOADS_FOR_PARTNERS
7474

7575
* `display_name` -
7676
(Required)

0 commit comments

Comments
 (0)