Skip to content

Commit 8012ce7

Browse files
Add Cloud Deploy Delivery Pipelines and Targets to tpg built from their DCL resources (#5999) (#11658)
Signed-off-by: Modular Magician <[email protected]>
1 parent 25bf499 commit 8012ce7

16 files changed

+2267
-1
lines changed

.changelog/5999.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
```release-note:new-resource
2+
`google_clouddeploy_delivery_pipeline`
3+
```
4+
```release-note:new-resource
5+
`google_clouddeploy_target`
6+
```

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module github.com/hashicorp/terraform-provider-google
22
require (
33
cloud.google.com/go/bigtable v1.13.0
44
cloud.google.com/go/iam v0.1.1 // indirect
5-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.5.1
5+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.5.2
66
github.com/apparentlymart/go-cidr v1.1.0
77
github.com/client9/misspell v0.3.4
88
github.com/davecgh/go-spew v1.1.1

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -1549,3 +1549,5 @@ github.com/GoogleCloudPlatform/declarative-resource-client-library v1.5.1 h1:Wsa
15491549
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.5.1/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
15501550
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.5.1 h1:WsauUAtzKxwcfR2SAN8K/yeHS6S4pGK6r/oJdKJaTgI=
15511551
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.5.1/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
1552+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.5.2 h1:SrHcyR/zNEaghHyLZvKKIjKL6RKNuESkyYZIgMHE3ko=
1553+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.5.2/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=

google/config.go

+1
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ type Config struct {
245245
// start DCLBasePaths
246246
// dataprocBasePath is implemented in mm
247247
AssuredWorkloadsBasePath string
248+
ClouddeployBasePath string
248249
CloudResourceManagerBasePath string
249250
ContainerAwsBasePath string
250251
ContainerAzureBasePath string

google/provider.go

+4
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,7 @@ func Provider() *schema.Provider {
693693

694694
// dcl
695695
AssuredWorkloadsEndpointEntryKey: AssuredWorkloadsEndpointEntry,
696+
ClouddeployEndpointEntryKey: ClouddeployEndpointEntry,
696697
CloudResourceManagerEndpointEntryKey: CloudResourceManagerEndpointEntry,
697698
EventarcEndpointEntryKey: EventarcEndpointEntry,
698699
FirebaserulesEndpointEntryKey: FirebaserulesEndpointEntry,
@@ -1240,6 +1241,8 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
12401241
"google_apikeys_key": resourceApikeysKey(),
12411242
"google_assured_workloads_workload": resourceAssuredWorkloadsWorkload(),
12421243
"google_cloudbuild_worker_pool": resourceCloudbuildWorkerPool(),
1244+
"google_clouddeploy_delivery_pipeline": resourceClouddeployDeliveryPipeline(),
1245+
"google_clouddeploy_target": resourceClouddeployTarget(),
12431246
"google_compute_firewall_policy_association": resourceComputeFirewallPolicyAssociation(),
12441247
"google_compute_firewall_policy": resourceComputeFirewallPolicy(),
12451248
"google_compute_firewall_policy_rule": resourceComputeFirewallPolicyRule(),
@@ -1492,6 +1495,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
14921495
// dcl
14931496
config.ApikeysBasePath = d.Get(ApikeysEndpointEntryKey).(string)
14941497
config.AssuredWorkloadsBasePath = d.Get(AssuredWorkloadsEndpointEntryKey).(string)
1498+
config.ClouddeployBasePath = d.Get(ClouddeployEndpointEntryKey).(string)
14951499
config.CloudResourceManagerBasePath = d.Get(CloudResourceManagerEndpointEntryKey).(string)
14961500
config.EventarcBasePath = d.Get(EventarcEndpointEntryKey).(string)
14971501
config.FirebaserulesBasePath = d.Get(FirebaserulesEndpointEntryKey).(string)

google/provider_dcl_client_creation.go

+24
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
assuredworkloads "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/assuredworkloads"
2424
bigqueryreservation "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/bigqueryreservation"
2525
cloudbuild "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/cloudbuild"
26+
clouddeploy "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/clouddeploy"
2627
cloudresourcemanager "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/cloudresourcemanager"
2728
compute "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/compute"
2829
containeraws "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/containeraws"
@@ -130,6 +131,29 @@ func NewDCLCloudbuildClient(config *Config, userAgent, billingProject string, ti
130131
return cloudbuild.NewClient(dclConfig)
131132
}
132133

134+
func NewDCLClouddeployClient(config *Config, userAgent, billingProject string, timeout time.Duration) *clouddeploy.Client {
135+
configOptions := []dcl.ConfigOption{
136+
dcl.WithHTTPClient(config.client),
137+
dcl.WithUserAgent(userAgent),
138+
dcl.WithLogger(dclLogger{}),
139+
dcl.WithBasePath(config.ClouddeployBasePath),
140+
}
141+
142+
if timeout != 0 {
143+
configOptions = append(configOptions, dcl.WithTimeout(timeout))
144+
}
145+
146+
if config.UserProjectOverride {
147+
configOptions = append(configOptions, dcl.WithUserProjectOverride())
148+
if billingProject != "" {
149+
configOptions = append(configOptions, dcl.WithBillingProject(billingProject))
150+
}
151+
}
152+
153+
dclConfig := dcl.NewConfig(configOptions...)
154+
return clouddeploy.NewClient(dclConfig)
155+
}
156+
133157
func NewDCLCloudResourceManagerClient(config *Config, userAgent, billingProject string, timeout time.Duration) *cloudresourcemanager.Client {
134158
configOptions := []dcl.ConfigOption{
135159
dcl.WithHTTPClient(config.client),

google/provider_dcl_endpoints.go

+12
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ var CloudBuildWorkerPoolEndpointEntry = &schema.Schema{
4949
}, ""),
5050
}
5151

52+
var ClouddeployEndpointEntryKey = "clouddeploy_custom_endpoint"
53+
var ClouddeployEndpointEntry = &schema.Schema{
54+
Type: schema.TypeString,
55+
Optional: true,
56+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
57+
"GOOGLE_CLOUDDEPLOY_CUSTOM_ENDPOINT",
58+
}, ""),
59+
}
60+
5261
var CloudResourceManagerEndpointEntryKey = "cloud_resource_manager_custom_endpoint"
5362
var CloudResourceManagerEndpointEntry = &schema.Schema{
5463
Type: schema.TypeString,
@@ -161,6 +170,7 @@ var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
161170
//ApikeysBasePath string
162171
//AssuredWorkloadsBasePath string
163172
//CloudBuildWorkerPoolBasePath string
173+
//ClouddeployBasePath string
164174
//CloudResourceManagerBasePath string
165175
//ComputeBasePath string
166176
//ContainerAwsBasePath string
@@ -178,6 +188,7 @@ var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
178188
// ApikeysEndpointEntryKey: ApikeysEndpointEntry,
179189
// AssuredWorkloadsEndpointEntryKey: AssuredWorkloadsEndpointEntry,
180190
// CloudBuildWorkerPoolEndpointEntryKey: CloudBuildWorkerPoolEndpointEntry,
191+
// ClouddeployEndpointEntryKey: ClouddeployEndpointEntry,
181192
// CloudResourceManagerEndpointEntryKey: CloudResourceManagerEndpointEntry,
182193
// ComputeEndpointEntryKey: ComputeEndpointEntry,
183194
// ContainerAwsEndpointEntryKey: ContainerAwsEndpointEntry,
@@ -195,6 +206,7 @@ var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
195206
// config.ApikeysBasePath = d.Get(ApikeysEndpointEntryKey).(string)
196207
// config.AssuredWorkloadsBasePath = d.Get(AssuredWorkloadsEndpointEntryKey).(string)
197208
// config.CloudBuildWorkerPoolBasePath = d.Get(CloudBuildWorkerPoolEndpointEntryKey).(string)
209+
// config.ClouddeployBasePath = d.Get(ClouddeployEndpointEntryKey).(string)
198210
// config.CloudResourceManagerBasePath = d.Get(CloudResourceManagerEndpointEntryKey).(string)
199211
// config.ComputeBasePath = d.Get(ComputeEndpointEntryKey).(string)
200212
// config.ContainerAwsBasePath = d.Get(ContainerAwsEndpointEntryKey).(string)

0 commit comments

Comments
 (0)