Skip to content

Commit

Permalink
upgraded dcl to v1.62.0 (#9941) (#17237)
Browse files Browse the repository at this point in the history
[upstream:4ed62f80ddd26e947ebf212247c2ce097616904b]

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician committed Feb 9, 2024
1 parent 6e72866 commit dbf9a45
Show file tree
Hide file tree
Showing 10 changed files with 250 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .changelog/9941.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:enhancement
eventarc: added support for `http_endpoint.uri` and `network_config.network_attachment` to `google_eventarc_trigger`
clouddeploy: added support for `canary_revision_tags`, `prior_revision_tags`, `stable_revision_tags`, and `stable_cutback_duration` to `google_clouddeploy_delivery_pipeline`
```
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ go 1.20

require (
cloud.google.com/go/bigtable v1.19.0
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.61.0
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.62.0
github.com/apparentlymart/go-cidr v1.1.0
github.com/davecgh/go-spew v1.1.1
github.com/dnaeon/go-vcr v1.0.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXE
cloud.google.com/go/longrunning v0.5.4 h1:w8xEcbZodnA2BbW6sVirkkoC+1gP8wS57EUUgGS0GVg=
cloud.google.com/go/longrunning v0.5.4/go.mod h1:zqNVncI0BOP8ST6XQD1+VcvuShMmq7+xFSzOL++V0dI=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.61.0 h1:IAr9UlYbxURIYABRMagXXo8pDlkFNFFXWz5J2+srrnc=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.61.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.62.0 h1:s4Y6r6RrYLBnqosGXLwR0h1Gqr0VT3wgd6rqvHsD9OE=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.62.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k=
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk=
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,27 @@ func ClouddeployDeliveryPipelineSerialPipelineStagesStrategyCanaryRuntimeConfigC
Optional: true,
Description: "Whether Cloud Deploy should update the traffic stanza in a Cloud Run Service on the user's behalf to facilitate traffic splitting. This is required to be true for CanaryDeployments, but optional for CustomCanaryDeployments.",
},

"canary_revision_tags": {
Type: schema.TypeList,
Optional: true,
Description: "Optional. A list of tags that are added to the canary revision while the canary phase is in progress.",
Elem: &schema.Schema{Type: schema.TypeString},
},

"prior_revision_tags": {
Type: schema.TypeList,
Optional: true,
Description: "Optional. A list of tags that are added to the prior revision while the canary phase is in progress.",
Elem: &schema.Schema{Type: schema.TypeString},
},

"stable_revision_tags": {
Type: schema.TypeList,
Optional: true,
Description: "Optional. A list of tags that are added to the final stable revision when the stable phase is applied.",
Elem: &schema.Schema{Type: schema.TypeString},
},
},
}
}
Expand Down Expand Up @@ -515,6 +536,12 @@ func ClouddeployDeliveryPipelineSerialPipelineStagesStrategyCanaryRuntimeConfigK
Optional: true,
Description: "Optional. The time to wait for route updates to propagate. The maximum configurable time is 3 hours, in seconds format. If unspecified, there is no wait time.",
},

"stable_cutback_duration": {
Type: schema.TypeString,
Optional: true,
Description: "Optional. The amount of time to migrate traffic back from the canary Service to the original Service during the stable phase deployment. If specified, must be between 15s and 3600s. If unspecified, there is no cutback time.",
},
},
}
}
Expand Down Expand Up @@ -1413,6 +1440,9 @@ func expandClouddeployDeliveryPipelineSerialPipelineStagesStrategyCanaryRuntimeC
obj := objArr[0].(map[string]interface{})
return &clouddeploy.DeliveryPipelineSerialPipelineStagesStrategyCanaryRuntimeConfigCloudRun{
AutomaticTrafficControl: dcl.Bool(obj["automatic_traffic_control"].(bool)),
CanaryRevisionTags: tpgdclresource.ExpandStringArray(obj["canary_revision_tags"]),
PriorRevisionTags: tpgdclresource.ExpandStringArray(obj["prior_revision_tags"]),
StableRevisionTags: tpgdclresource.ExpandStringArray(obj["stable_revision_tags"]),
}
}

Expand All @@ -1422,6 +1452,9 @@ func flattenClouddeployDeliveryPipelineSerialPipelineStagesStrategyCanaryRuntime
}
transformed := map[string]interface{}{
"automatic_traffic_control": obj.AutomaticTrafficControl,
"canary_revision_tags": obj.CanaryRevisionTags,
"prior_revision_tags": obj.PriorRevisionTags,
"stable_revision_tags": obj.StableRevisionTags,
}

return []interface{}{transformed}
Expand Down Expand Up @@ -1466,10 +1499,11 @@ func expandClouddeployDeliveryPipelineSerialPipelineStagesStrategyCanaryRuntimeC
}
obj := objArr[0].(map[string]interface{})
return &clouddeploy.DeliveryPipelineSerialPipelineStagesStrategyCanaryRuntimeConfigKubernetesGatewayServiceMesh{
Deployment: dcl.String(obj["deployment"].(string)),
HttpRoute: dcl.String(obj["http_route"].(string)),
Service: dcl.String(obj["service"].(string)),
RouteUpdateWaitTime: dcl.String(obj["route_update_wait_time"].(string)),
Deployment: dcl.String(obj["deployment"].(string)),
HttpRoute: dcl.String(obj["http_route"].(string)),
Service: dcl.String(obj["service"].(string)),
RouteUpdateWaitTime: dcl.String(obj["route_update_wait_time"].(string)),
StableCutbackDuration: dcl.String(obj["stable_cutback_duration"].(string)),
}
}

Expand All @@ -1478,10 +1512,11 @@ func flattenClouddeployDeliveryPipelineSerialPipelineStagesStrategyCanaryRuntime
return nil
}
transformed := map[string]interface{}{
"deployment": obj.Deployment,
"http_route": obj.HttpRoute,
"service": obj.Service,
"route_update_wait_time": obj.RouteUpdateWaitTime,
"deployment": obj.Deployment,
"http_route": obj.HttpRoute,
"service": obj.Service,
"route_update_wait_time": obj.RouteUpdateWaitTime,
"stable_cutback_duration": obj.StableCutbackDuration,
}

return []interface{}{transformed}
Expand Down
97 changes: 97 additions & 0 deletions google/services/eventarc/resource_eventarc_trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,22 @@ func EventarcTriggerDestinationSchema() *schema.Resource {
Elem: EventarcTriggerDestinationGkeSchema(),
},

"http_endpoint": {
Type: schema.TypeList,
Optional: true,
Description: "An HTTP endpoint destination described by an URI.",
MaxItems: 1,
Elem: EventarcTriggerDestinationHttpEndpointSchema(),
},

"network_config": {
Type: schema.TypeList,
Optional: true,
Description: "Optional. Network config is used to configure how Eventarc resolves and connect to a destination. This should only be used with HttpEndpoint destination type.",
MaxItems: 1,
Elem: EventarcTriggerDestinationNetworkConfigSchema(),
},

"workflow": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -279,6 +295,31 @@ func EventarcTriggerDestinationGkeSchema() *schema.Resource {
}
}

func EventarcTriggerDestinationHttpEndpointSchema() *schema.Resource {
return &schema.Resource{
Schema: map[string]*schema.Schema{
"uri": {
Type: schema.TypeString,
Required: true,
Description: "Required. The URI of the HTTP enpdoint. The value must be a RFC2396 URI string. Examples: `http://10.10.10.8:80/route`, `http://svc.us-central1.p.local:8080/`. Only HTTP and HTTPS protocols are supported. The host can be either a static IP addressable from the VPC specified by the network config, or an internal DNS hostname of the service resolvable via Cloud DNS.",
},
},
}
}

func EventarcTriggerDestinationNetworkConfigSchema() *schema.Resource {
return &schema.Resource{
Schema: map[string]*schema.Schema{
"network_attachment": {
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName,
Description: "Required. Name of the NetworkAttachment that allows access to the destination VPC. Format: `projects/{PROJECT_ID}/regions/{REGION}/networkAttachments/{NETWORK_ATTACHMENT_NAME}`",
},
},
}
}

func EventarcTriggerMatchingCriteriaSchema() *schema.Resource {
return &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -621,6 +662,8 @@ func expandEventarcTriggerDestination(o interface{}) *eventarc.TriggerDestinatio
return &eventarc.TriggerDestination{
CloudRunService: expandEventarcTriggerDestinationCloudRunService(obj["cloud_run_service"]),
Gke: expandEventarcTriggerDestinationGke(obj["gke"]),
HttpEndpoint: expandEventarcTriggerDestinationHttpEndpoint(obj["http_endpoint"]),
NetworkConfig: expandEventarcTriggerDestinationNetworkConfig(obj["network_config"]),
Workflow: dcl.String(obj["workflow"].(string)),
}
}
Expand All @@ -632,6 +675,8 @@ func flattenEventarcTriggerDestination(obj *eventarc.TriggerDestination) interfa
transformed := map[string]interface{}{
"cloud_run_service": flattenEventarcTriggerDestinationCloudRunService(obj.CloudRunService),
"gke": flattenEventarcTriggerDestinationGke(obj.Gke),
"http_endpoint": flattenEventarcTriggerDestinationHttpEndpoint(obj.HttpEndpoint),
"network_config": flattenEventarcTriggerDestinationNetworkConfig(obj.NetworkConfig),
"workflow": obj.Workflow,
"cloud_function": obj.CloudFunction,
}
Expand Down Expand Up @@ -702,6 +747,58 @@ func flattenEventarcTriggerDestinationGke(obj *eventarc.TriggerDestinationGke) i

return []interface{}{transformed}

}

func expandEventarcTriggerDestinationHttpEndpoint(o interface{}) *eventarc.TriggerDestinationHttpEndpoint {
if o == nil {
return eventarc.EmptyTriggerDestinationHttpEndpoint
}
objArr := o.([]interface{})
if len(objArr) == 0 || objArr[0] == nil {
return eventarc.EmptyTriggerDestinationHttpEndpoint
}
obj := objArr[0].(map[string]interface{})
return &eventarc.TriggerDestinationHttpEndpoint{
Uri: dcl.String(obj["uri"].(string)),
}
}

func flattenEventarcTriggerDestinationHttpEndpoint(obj *eventarc.TriggerDestinationHttpEndpoint) interface{} {
if obj == nil || obj.Empty() {
return nil
}
transformed := map[string]interface{}{
"uri": obj.Uri,
}

return []interface{}{transformed}

}

func expandEventarcTriggerDestinationNetworkConfig(o interface{}) *eventarc.TriggerDestinationNetworkConfig {
if o == nil {
return eventarc.EmptyTriggerDestinationNetworkConfig
}
objArr := o.([]interface{})
if len(objArr) == 0 || objArr[0] == nil {
return eventarc.EmptyTriggerDestinationNetworkConfig
}
obj := objArr[0].(map[string]interface{})
return &eventarc.TriggerDestinationNetworkConfig{
NetworkAttachment: dcl.String(obj["network_attachment"].(string)),
}
}

func flattenEventarcTriggerDestinationNetworkConfig(obj *eventarc.TriggerDestinationNetworkConfig) interface{} {
if obj == nil || obj.Empty() {
return nil
}
transformed := map[string]interface{}{
"network_attachment": obj.NetworkAttachment,
}

return []interface{}{transformed}

}
func expandEventarcTriggerMatchingCriteriaArray(o interface{}) []eventarc.TriggerMatchingCriteria {
if o == nil {
Expand Down
65 changes: 65 additions & 0 deletions google/services/eventarc/resource_eventarc_trigger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,43 @@ func TestAccEventarcTrigger_channel(t *testing.T) {
})
}

func TestAccEventarcTrigger_HttpDest(t *testing.T) {
t.Parallel()

region := envvar.GetTestRegionFromEnv()

testNetworkName := acctest.BootstrapSharedTestNetwork(t, "attachment-network")
subnetName := acctest.BootstrapSubnet(t, "tf-test-subnet", testNetworkName)
networkAttachmentName := acctest.BootstrapNetworkAttachment(t, "tf-test-attachment", subnetName)

// Need to have the full network attachment name in the format project/{project_id}/regions/{region_id}/networkAttachments/{networkAttachmentName}
fullFormNetworkAttachmentName := fmt.Sprintf("projects/%s/regions/%s/networkAttachments/%s", envvar.GetTestProjectFromEnv(), envvar.GetTestRegionFromEnv(), networkAttachmentName)

context := map[string]interface{}{
"region": region,
"project_name": envvar.GetTestProjectFromEnv(),
"service_account": envvar.GetTestServiceAccountFromEnv(t),
"network_attachment": fullFormNetworkAttachmentName,
"random_suffix": acctest.RandString(t, 10),
}

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckEventarcChannelTriggerDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccEventarcTrigger_createTriggerWithHttpDest(context),
},
{
ResourceName: "google_eventarc_trigger.primary",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func testAccEventarcTrigger_createTriggerWithChannelName(context map[string]interface{}) string {
return acctest.Nprintf(`
data "google_project" "test_project" {
Expand Down Expand Up @@ -134,6 +171,34 @@ resource "google_eventarc_trigger" "primary" {
`, context)
}

func testAccEventarcTrigger_createTriggerWithHttpDest(context map[string]interface{}) string {
return acctest.Nprintf(`
data "google_project" "test_project" {
project_id = "%{project_name}"
}
resource "google_eventarc_trigger" "primary" {
name = "tf-test-trigger%{random_suffix}"
location = "%{region}"
matching_criteria {
attribute = "type"
value = "google.cloud.pubsub.topic.v1.messagePublished"
}
destination {
http_endpoint {
uri = "http://10.10.10.8:80/route"
}
network_config {
network_attachment = "%{network_attachment}"
}
}
service_account = "%{service_account}"
}
`, context)
}

func testAccCheckEventarcChannelTriggerDestroyProducer(t *testing.T) func(s *terraform.State) error {
return func(s *terraform.State) error {
for name, rs := range s.RootModule().Resources {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func ResourceRecaptchaEnterpriseKey() *schema.Resource {
"name": {
Type: schema.TypeString,
Computed: true,
Description: "The resource name for the Key in the format \"projects/{project}/keys/{key}\".",
Description: "The resource id for the Key, which is the same as the Site Key itself.",
},

"terraform_labels": {
Expand Down
16 changes: 16 additions & 0 deletions website/docs/r/clouddeploy_delivery_pipeline.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,18 @@ The `cloud_run` block supports:
(Optional)
Whether Cloud Deploy should update the traffic stanza in a Cloud Run Service on the user's behalf to facilitate traffic splitting. This is required to be true for CanaryDeployments, but optional for CustomCanaryDeployments.

* `canary_revision_tags` -
(Optional)
Optional. A list of tags that are added to the canary revision while the canary phase is in progress.

* `prior_revision_tags` -
(Optional)
Optional. A list of tags that are added to the prior revision while the canary phase is in progress.

* `stable_revision_tags` -
(Optional)
Optional. A list of tags that are added to the final stable revision when the stable phase is applied.

The `kubernetes` block supports:

* `gateway_service_mesh` -
Expand Down Expand Up @@ -467,6 +479,10 @@ The `gateway_service_mesh` block supports:
(Required)
Required. Name of the Kubernetes Service.

* `stable_cutback_duration` -
(Optional)
Optional. The amount of time to migrate traffic back from the canary Service to the original Service during the stable phase deployment. If specified, must be between 15s and 3600s. If unspecified, there is no cutback time.

The `service_networking` block supports:

* `deployment` -
Expand Down
Loading

0 comments on commit dbf9a45

Please sign in to comment.