Skip to content

Commit f0dc6e6

Browse files
Upgrade DCL to v1.21.1 (#6576) (#12619)
* Upgrade DCL to v1.21.1 * Fix up formatting of mmv1/third_party/terraform/go.sum Signed-off-by: Modular Magician <[email protected]> Signed-off-by: Modular Magician <[email protected]>
1 parent 12fc5e0 commit f0dc6e6

10 files changed

+232
-13
lines changed

.changelog/6576.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
```release-note:enhancement
2+
eventarc: added `channels` and `conditions` fields to `google_eventarc_trigger`
3+
```
4+
```release-note:enhancement
5+
clouddeploy: added `serial_pipeline.stages.strategy` field to `google_clouddeploy_delivery_pipeline
6+
```

go.mod

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

44
require (
55
cloud.google.com/go/bigtable v1.16.0
6-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.19.0
6+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.21.1
77
github.com/apparentlymart/go-cidr v1.1.0
88
github.com/client9/misspell v0.3.4
99
github.com/davecgh/go-spew v1.1.1

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
7676
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
7777
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM=
7878
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs=
79-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.19.0 h1:4YAtk4xuOCxUSkGdwlDhkX7DTP4VwLZCoebGGEsU+U4=
80-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.19.0/go.mod h1:i6Pmzp7aolLmJY86RaJ9wjqm/HFleMeN7Vl5uIWLwE8=
79+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.21.1 h1:WPrdiImW8A7kmMZF95dVAybR3H/ItAfJXPdRJnwf/yg=
80+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.21.1/go.mod h1:i6Pmzp7aolLmJY86RaJ9wjqm/HFleMeN7Vl5uIWLwE8=
8181
github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
8282
github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
8383
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=

google/resource_clouddeploy_delivery_pipeline.go

+88
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{
@@ -534,6 +568,7 @@ func expandClouddeployDeliveryPipelineSerialPipelineStages(o interface{}) *cloud
534568
obj := o.(map[string]interface{})
535569
return &clouddeploy.DeliveryPipelineSerialPipelineStages{
536570
Profiles: expandStringArray(obj["profiles"]),
571+
Strategy: expandClouddeployDeliveryPipelineSerialPipelineStagesStrategy(obj["strategy"]),
537572
TargetId: dcl.String(obj["target_id"].(string)),
538573
}
539574
}
@@ -558,13 +593,66 @@ func flattenClouddeployDeliveryPipelineSerialPipelineStages(obj *clouddeploy.Del
558593
}
559594
transformed := map[string]interface{}{
560595
"profiles": obj.Profiles,
596+
"strategy": flattenClouddeployDeliveryPipelineSerialPipelineStagesStrategy(obj.Strategy),
561597
"target_id": obj.TargetId,
562598
}
563599

564600
return transformed
565601

566602
}
567603

604+
func expandClouddeployDeliveryPipelineSerialPipelineStagesStrategy(o interface{}) *clouddeploy.DeliveryPipelineSerialPipelineStagesStrategy {
605+
if o == nil {
606+
return clouddeploy.EmptyDeliveryPipelineSerialPipelineStagesStrategy
607+
}
608+
objArr := o.([]interface{})
609+
if len(objArr) == 0 || objArr[0] == nil {
610+
return clouddeploy.EmptyDeliveryPipelineSerialPipelineStagesStrategy
611+
}
612+
obj := objArr[0].(map[string]interface{})
613+
return &clouddeploy.DeliveryPipelineSerialPipelineStagesStrategy{
614+
Standard: expandClouddeployDeliveryPipelineSerialPipelineStagesStrategyStandard(obj["standard"]),
615+
}
616+
}
617+
618+
func flattenClouddeployDeliveryPipelineSerialPipelineStagesStrategy(obj *clouddeploy.DeliveryPipelineSerialPipelineStagesStrategy) interface{} {
619+
if obj == nil || obj.Empty() {
620+
return nil
621+
}
622+
transformed := map[string]interface{}{
623+
"standard": flattenClouddeployDeliveryPipelineSerialPipelineStagesStrategyStandard(obj.Standard),
624+
}
625+
626+
return []interface{}{transformed}
627+
628+
}
629+
630+
func expandClouddeployDeliveryPipelineSerialPipelineStagesStrategyStandard(o interface{}) *clouddeploy.DeliveryPipelineSerialPipelineStagesStrategyStandard {
631+
if o == nil {
632+
return clouddeploy.EmptyDeliveryPipelineSerialPipelineStagesStrategyStandard
633+
}
634+
objArr := o.([]interface{})
635+
if len(objArr) == 0 || objArr[0] == nil {
636+
return clouddeploy.EmptyDeliveryPipelineSerialPipelineStagesStrategyStandard
637+
}
638+
obj := objArr[0].(map[string]interface{})
639+
return &clouddeploy.DeliveryPipelineSerialPipelineStagesStrategyStandard{
640+
Verify: dcl.Bool(obj["verify"].(bool)),
641+
}
642+
}
643+
644+
func flattenClouddeployDeliveryPipelineSerialPipelineStagesStrategyStandard(obj *clouddeploy.DeliveryPipelineSerialPipelineStagesStrategyStandard) interface{} {
645+
if obj == nil || obj.Empty() {
646+
return nil
647+
}
648+
transformed := map[string]interface{}{
649+
"verify": obj.Verify,
650+
}
651+
652+
return []interface{}{transformed}
653+
654+
}
655+
568656
func flattenClouddeployDeliveryPipelineCondition(obj *clouddeploy.DeliveryPipelineCondition) interface{} {
569657
if obj == nil || obj.Empty() {
570658
return nil

google/resource_clouddeploy_target.go

+72-10
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,
@@ -183,6 +192,12 @@ func ClouddeployTargetExecutionConfigsSchema() *schema.Resource {
183192
Description: "Optional. Cloud Storage location in which to store execution outputs. This can either be a bucket (\"gs://my-bucket\") or a path within a bucket (\"gs://my-bucket/my-dir\"). If unspecified, a default bucket located in the same region will be used.",
184193
},
185194

195+
"execution_timeout": {
196+
Type: schema.TypeString,
197+
Optional: true,
198+
Description: "Optional. Execution timeout for a Cloud Build Execution. This must be between 10m and 24h in seconds format. If unspecified, a default timeout of 1h is used.",
199+
},
200+
186201
"service_account": {
187202
Type: schema.TypeString,
188203
Computed: true,
@@ -219,6 +234,18 @@ func ClouddeployTargetGkeSchema() *schema.Resource {
219234
}
220235
}
221236

237+
func ClouddeployTargetRunSchema() *schema.Resource {
238+
return &schema.Resource{
239+
Schema: map[string]*schema.Schema{
240+
"location": {
241+
Type: schema.TypeString,
242+
Required: true,
243+
Description: "Required. The location where the Cloud Run Service should be located. Format is `projects/{project}/locations/{location}`.",
244+
},
245+
},
246+
}
247+
}
248+
222249
func resourceClouddeployTargetCreate(d *schema.ResourceData, meta interface{}) error {
223250
config := meta.(*Config)
224251
project, err := getProject(d, config)
@@ -237,6 +264,7 @@ func resourceClouddeployTargetCreate(d *schema.ResourceData, meta interface{}) e
237264
Labels: checkStringMap(d.Get("labels")),
238265
Project: dcl.String(project),
239266
RequireApproval: dcl.Bool(d.Get("require_approval").(bool)),
267+
Run: expandClouddeployTargetRun(d.Get("run")),
240268
}
241269

242270
id, err := obj.ID()
@@ -294,6 +322,7 @@ func resourceClouddeployTargetRead(d *schema.ResourceData, meta interface{}) err
294322
Labels: checkStringMap(d.Get("labels")),
295323
Project: dcl.String(project),
296324
RequireApproval: dcl.Bool(d.Get("require_approval").(bool)),
325+
Run: expandClouddeployTargetRun(d.Get("run")),
297326
}
298327

299328
userAgent, err := generateUserAgentString(d, config.userAgent)
@@ -348,6 +377,9 @@ func resourceClouddeployTargetRead(d *schema.ResourceData, meta interface{}) err
348377
if err = d.Set("require_approval", res.RequireApproval); err != nil {
349378
return fmt.Errorf("error setting require_approval in state: %s", err)
350379
}
380+
if err = d.Set("run", flattenClouddeployTargetRun(res.Run)); err != nil {
381+
return fmt.Errorf("error setting run in state: %s", err)
382+
}
351383
if err = d.Set("create_time", res.CreateTime); err != nil {
352384
return fmt.Errorf("error setting create_time in state: %s", err)
353385
}
@@ -384,6 +416,7 @@ func resourceClouddeployTargetUpdate(d *schema.ResourceData, meta interface{}) e
384416
Labels: checkStringMap(d.Get("labels")),
385417
Project: dcl.String(project),
386418
RequireApproval: dcl.Bool(d.Get("require_approval").(bool)),
419+
Run: expandClouddeployTargetRun(d.Get("run")),
387420
}
388421
directive := UpdateDirective
389422
userAgent, err := generateUserAgentString(d, config.userAgent)
@@ -436,6 +469,7 @@ func resourceClouddeployTargetDelete(d *schema.ResourceData, meta interface{}) e
436469
Labels: checkStringMap(d.Get("labels")),
437470
Project: dcl.String(project),
438471
RequireApproval: dcl.Bool(d.Get("require_approval").(bool)),
472+
Run: expandClouddeployTargetRun(d.Get("run")),
439473
}
440474

441475
log.Printf("[DEBUG] Deleting Target %q", d.Id())
@@ -535,10 +569,11 @@ func expandClouddeployTargetExecutionConfigs(o interface{}) *clouddeploy.TargetE
535569

536570
obj := o.(map[string]interface{})
537571
return &clouddeploy.TargetExecutionConfigs{
538-
Usages: expandClouddeployTargetExecutionConfigsUsagesArray(obj["usages"]),
539-
ArtifactStorage: dcl.StringOrNil(obj["artifact_storage"].(string)),
540-
ServiceAccount: dcl.StringOrNil(obj["service_account"].(string)),
541-
WorkerPool: dcl.String(obj["worker_pool"].(string)),
572+
Usages: expandClouddeployTargetExecutionConfigsUsagesArray(obj["usages"]),
573+
ArtifactStorage: dcl.StringOrNil(obj["artifact_storage"].(string)),
574+
ExecutionTimeout: dcl.String(obj["execution_timeout"].(string)),
575+
ServiceAccount: dcl.StringOrNil(obj["service_account"].(string)),
576+
WorkerPool: dcl.String(obj["worker_pool"].(string)),
542577
}
543578
}
544579

@@ -561,10 +596,11 @@ func flattenClouddeployTargetExecutionConfigs(obj *clouddeploy.TargetExecutionCo
561596
return nil
562597
}
563598
transformed := map[string]interface{}{
564-
"usages": flattenClouddeployTargetExecutionConfigsUsagesArray(obj.Usages),
565-
"artifact_storage": obj.ArtifactStorage,
566-
"service_account": obj.ServiceAccount,
567-
"worker_pool": obj.WorkerPool,
599+
"usages": flattenClouddeployTargetExecutionConfigsUsagesArray(obj.Usages),
600+
"artifact_storage": obj.ArtifactStorage,
601+
"execution_timeout": obj.ExecutionTimeout,
602+
"service_account": obj.ServiceAccount,
603+
"worker_pool": obj.WorkerPool,
568604
}
569605

570606
return transformed
@@ -597,6 +633,32 @@ func flattenClouddeployTargetGke(obj *clouddeploy.TargetGke) interface{} {
597633

598634
return []interface{}{transformed}
599635

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

0 commit comments

Comments
 (0)