From 81a1e16fd16dd74496d91129e123fb1f3583911c Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 7 Nov 2022 13:46:10 -0800 Subject: [PATCH] Upgrade the dcl version to v1.26.0 (#6639) (#12965) * Upgrade DCL to v1.23.0 * add clouddeploy test files * upgrade dcl to v1.25 * upgrade dcl to v1.26 * delete extra samples folder. test executionTimeout field in run target json * add tags, and monitoring_config * Add monitoringConfig to other files * Add a test for GKEHub servicemesh and exclude Eventarc trigger channel field * remove monitoring_config in handwritten tests and adding exclude for field in beta Co-authored-by: Chris Hawk Co-authored-by: Ghaleb Al-habian Co-authored-by: ghabian Signed-off-by: Modular Magician Signed-off-by: Modular Magician Co-authored-by: Chris Hawk Co-authored-by: Ghaleb Al-habian Co-authored-by: ghabian --- .changelog/6639.txt | 16 ++++++ go.mod | 2 +- go.sum | 6 ++- .../resource_clouddeploy_delivery_pipeline.go | 2 +- google/resource_clouddeploy_target.go | 25 ++++++--- google/resource_container_aws_cluster.go | 1 - google/resource_eventarc_trigger.go | 10 ++++ ...louddeploy_delivery_pipeline.html.markdown | 54 +++++++++++++++++++ .../docs/r/clouddeploy_target.html.markdown | 50 +++++++++++++++++ website/docs/r/eventarc_trigger.html.markdown | 3 ++ 10 files changed, 156 insertions(+), 13 deletions(-) create mode 100644 .changelog/6639.txt diff --git a/.changelog/6639.txt b/.changelog/6639.txt new file mode 100644 index 0000000000..0edada8785 --- /dev/null +++ b/.changelog/6639.txt @@ -0,0 +1,16 @@ +```release-note:enhancement +clouddeploy: Added support for Cloud Run Targets (beta) +``` +```release-note:enhancement +clouddeploy: Added support for Deployment Verification standard strategy (beta) +``` +```release-note:enhancement +clouddeploy: Added execution_configs.execution_timeout in target resource. (beta) +``` +```release-note:enhancement +compute: machine_type field in compute instance resource now accepts short name. +``` +```release-note:enhancement +orgpolicy: Changed spec.rules type from Array to Set in policy resource. +https://github.com/hashicorp/terraform-provider-google/issues/12363 +``` diff --git a/go.mod b/go.mod index 6417756b1a..8c013ed4aa 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ go 1.18 require ( cloud.google.com/go/bigtable v1.16.0 - github.com/GoogleCloudPlatform/declarative-resource-client-library v1.19.0 + github.com/GoogleCloudPlatform/declarative-resource-client-library v1.26.0 github.com/apparentlymart/go-cidr v1.1.0 github.com/client9/misspell v0.3.4 github.com/davecgh/go-spew v1.1.1 diff --git a/go.sum b/go.sum index 369e805208..bf34c9031b 100644 --- a/go.sum +++ b/go.sum @@ -71,8 +71,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.19.0 h1:4YAtk4xuOCxUSkGdwlDhkX7DTP4VwLZCoebGGEsU+U4= -github.com/GoogleCloudPlatform/declarative-resource-client-library v1.19.0/go.mod h1:i6Pmzp7aolLmJY86RaJ9wjqm/HFleMeN7Vl5uIWLwE8= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.26.0 h1:9RQhnEju2B+3njLTERnIeotRoI3GOQrN7kXA+n3iuJw= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.26.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k= github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= @@ -1463,3 +1463,5 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8 rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.26.0 h1:9RQhnEju2B+3njLTERnIeotRoI3GOQrN7kXA+n3iuJw= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.26.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k= diff --git a/google/resource_clouddeploy_delivery_pipeline.go b/google/resource_clouddeploy_delivery_pipeline.go index e86f00483d..178eb7b9ba 100644 --- a/google/resource_clouddeploy_delivery_pipeline.go +++ b/google/resource_clouddeploy_delivery_pipeline.go @@ -181,7 +181,7 @@ func ClouddeployDeliveryPipelineConditionSchema() *schema.Resource { "targets_present_condition": { Type: schema.TypeList, Computed: true, - Description: "Detalis around targets enumerated in the pipeline.", + Description: "Details around targets enumerated in the pipeline.", Elem: ClouddeployDeliveryPipelineConditionTargetsPresentConditionSchema(), }, }, diff --git a/google/resource_clouddeploy_target.go b/google/resource_clouddeploy_target.go index f0a243e29b..c8e203dbd9 100644 --- a/google/resource_clouddeploy_target.go +++ b/google/resource_clouddeploy_target.go @@ -183,6 +183,13 @@ func ClouddeployTargetExecutionConfigsSchema() *schema.Resource { 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.", }, + "execution_timeout": { + Type: schema.TypeString, + Computed: true, + Optional: true, + 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.", + }, + "service_account": { Type: schema.TypeString, Computed: true, @@ -535,10 +542,11 @@ func expandClouddeployTargetExecutionConfigs(o interface{}) *clouddeploy.TargetE obj := o.(map[string]interface{}) return &clouddeploy.TargetExecutionConfigs{ - Usages: expandClouddeployTargetExecutionConfigsUsagesArray(obj["usages"]), - ArtifactStorage: dcl.StringOrNil(obj["artifact_storage"].(string)), - ServiceAccount: dcl.StringOrNil(obj["service_account"].(string)), - WorkerPool: dcl.String(obj["worker_pool"].(string)), + Usages: expandClouddeployTargetExecutionConfigsUsagesArray(obj["usages"]), + ArtifactStorage: dcl.StringOrNil(obj["artifact_storage"].(string)), + ExecutionTimeout: dcl.StringOrNil(obj["execution_timeout"].(string)), + ServiceAccount: dcl.StringOrNil(obj["service_account"].(string)), + WorkerPool: dcl.String(obj["worker_pool"].(string)), } } @@ -561,10 +569,11 @@ func flattenClouddeployTargetExecutionConfigs(obj *clouddeploy.TargetExecutionCo return nil } transformed := map[string]interface{}{ - "usages": flattenClouddeployTargetExecutionConfigsUsagesArray(obj.Usages), - "artifact_storage": obj.ArtifactStorage, - "service_account": obj.ServiceAccount, - "worker_pool": obj.WorkerPool, + "usages": flattenClouddeployTargetExecutionConfigsUsagesArray(obj.Usages), + "artifact_storage": obj.ArtifactStorage, + "execution_timeout": obj.ExecutionTimeout, + "service_account": obj.ServiceAccount, + "worker_pool": obj.WorkerPool, } return transformed diff --git a/google/resource_container_aws_cluster.go b/google/resource_container_aws_cluster.go index 58531cb747..420579e1fc 100644 --- a/google/resource_container_aws_cluster.go +++ b/google/resource_container_aws_cluster.go @@ -299,7 +299,6 @@ func ContainerAwsClusterControlPlaneSchema() *schema.Resource { "tags": { Type: schema.TypeMap, Optional: true, - ForceNew: true, Description: "Optional. A set of AWS resource tags to propagate to all underlying managed AWS resources. Specify at most 50 pairs containing alphanumerics, spaces, and symbols (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to 255 Unicode characters.", Elem: &schema.Schema{Type: schema.TypeString}, }, diff --git a/google/resource_eventarc_trigger.go b/google/resource_eventarc_trigger.go index d33028cedc..8c32aac2e0 100644 --- a/google/resource_eventarc_trigger.go +++ b/google/resource_eventarc_trigger.go @@ -108,6 +108,13 @@ func resourceEventarcTrigger() *schema.Resource { Elem: EventarcTriggerTransportSchema(), }, + "conditions": { + Type: schema.TypeMap, + Computed: true, + Description: "Output only. The reason(s) why a trigger is in FAILED state.", + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "create_time": { Type: schema.TypeString, Computed: true, @@ -412,6 +419,9 @@ func resourceEventarcTriggerRead(d *schema.ResourceData, meta interface{}) error if err = d.Set("transport", flattenEventarcTriggerTransport(res.Transport)); err != nil { return fmt.Errorf("error setting transport in state: %s", err) } + if err = d.Set("conditions", res.Conditions); err != nil { + return fmt.Errorf("error setting conditions in state: %s", err) + } if err = d.Set("create_time", res.CreateTime); err != nil { return fmt.Errorf("error setting create_time in state: %s", err) } diff --git a/website/docs/r/clouddeploy_delivery_pipeline.html.markdown b/website/docs/r/clouddeploy_delivery_pipeline.html.markdown index 34b3500e80..1d6bb76450 100644 --- a/website/docs/r/clouddeploy_delivery_pipeline.html.markdown +++ b/website/docs/r/clouddeploy_delivery_pipeline.html.markdown @@ -60,6 +60,44 @@ resource "google_clouddeploy_delivery_pipeline" "primary" { } +``` +## Example Usage - verify_delivery_pipeline +tests creating and updating a delivery pipeline with deployment verification strategy +```hcl +resource "google_clouddeploy_delivery_pipeline" "primary" { + location = "us-west1" + name = "pipeline" + + annotations = { + my_first_annotation = "example-annotation-1" + + my_second_annotation = "example-annotation-2" + } + + description = "basic description" + + labels = { + my_first_label = "example-label-1" + + my_second_label = "example-label-2" + } + + project = "my-project-name" + + serial_pipeline { + stages { + profiles = ["example-profile-one", "example-profile-two"] + target_id = "example-target-one" + } + + stages { + profiles = [] + target_id = "example-target-two" + } + } + provider = google-beta +} + ``` ## Argument Reference @@ -116,10 +154,26 @@ The `stages` block supports: (Optional) Skaffold profiles to use when rendering the manifest for this stage's `Target`. +* `strategy` - + (Optional) + (Beta only) Optional. The strategy to use for a `Rollout` to this stage. + * `target_id` - (Optional) The target_id to which this stage points. This field refers exclusively to the last segment of a target name. For example, this field would just be `my-target` (rather than `projects/project/locations/location/targets/my-target`). The location of the `Target` is inferred to be the same as the location of the `DeliveryPipeline` that contains this `Stage`. +The `strategy` block supports: + +* `standard` - + (Optional) + Standard deployment strategy executes a single deploy and allows verifying the deployment. + +The `standard` block supports: + +* `verify` - + (Optional) + Whether to verify a deployment. + ## Attributes Reference In addition to the arguments listed above, the following computed attributes are exported: diff --git a/website/docs/r/clouddeploy_target.html.markdown b/website/docs/r/clouddeploy_target.html.markdown index 91978bbb16..62e983949e 100644 --- a/website/docs/r/clouddeploy_target.html.markdown +++ b/website/docs/r/clouddeploy_target.html.markdown @@ -23,6 +23,42 @@ description: |- The Cloud Deploy `Target` resource +## Example Usage - run_target +tests creating and updating a cloud run target +```hcl +resource "google_clouddeploy_target" "primary" { + location = "us-west1" + name = "target" + + annotations = { + my_first_annotation = "example-annotation-1" + + my_second_annotation = "example-annotation-2" + } + + description = "basic description" + + execution_configs { + usages = ["RENDER", "DEPLOY"] + execution_timeout = "3600s" + } + + labels = { + my_first_label = "example-label-1" + + my_second_label = "example-label-2" + } + + project = "my-project-name" + require_approval = false + + run { + location = "projects/my-project-name/locations/us-west1" + } + provider = google-beta +} + +``` ## Example Usage - target Creates a basic Cloud Deploy target ```hcl @@ -103,6 +139,10 @@ The following arguments are supported: (Optional) Optional. Whether or not the `Target` requires approval. +* `run` - + (Optional) + (Beta only) Information specifying a Cloud Run deployment target. + The `anthos_cluster` block supports: @@ -117,6 +157,10 @@ The `execution_configs` block supports: (Optional) 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. +* `execution_timeout` - + (Optional) + 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. + * `service_account` - (Optional) Optional. Google service account to use for execution. If unspecified, the project execution service account (-compute@developer.gserviceaccount.com) is used. @@ -139,6 +183,12 @@ The `gke` block supports: (Optional) Optional. If true, `cluster` is accessed using the private IP address of the control plane endpoint. Otherwise, the default IP address of the control plane endpoint is used. The default IP address is the private IP address for clusters with private control-plane endpoints and the public IP address otherwise. Only specify this option when `cluster` is a [private GKE cluster](https://cloud.google.com/kubernetes-engine/docs/concepts/private-cluster-concept). +The `run` block supports: + +* `location` - + (Required) + Required. The location where the Cloud Run Service should be located. Format is `projects/{project}/locations/{location}`. + ## Attributes Reference In addition to the arguments listed above, the following computed attributes are exported: diff --git a/website/docs/r/eventarc_trigger.html.markdown b/website/docs/r/eventarc_trigger.html.markdown index 28226ebcce..506864e7f3 100644 --- a/website/docs/r/eventarc_trigger.html.markdown +++ b/website/docs/r/eventarc_trigger.html.markdown @@ -207,6 +207,9 @@ In addition to the arguments listed above, the following computed attributes are * `id` - an identifier for the resource with format `projects/{{project}}/locations/{{location}}/triggers/{{name}}` +* `conditions` - + Output only. The reason(s) why a trigger is in FAILED state. + * `create_time` - Output only. The creation time.