Skip to content

Commit bba3e08

Browse files
Add Dataplex Lake to tpg built from their DCL resources (#6055) (#11769)
* Only add Dataplex lake resources * run make serialize * Moved samples to the correct location * Use lake instead of lake_name as variable placeholder * migrate to DCL version 1.8 * Updated DCL to 1.8.1 * Updated DCL to 1.8.2 Signed-off-by: Modular Magician <[email protected]>
1 parent 2c39a04 commit bba3e08

14 files changed

+934
-5
lines changed

.changelog/6055.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:new-resource
2+
`google_dataplex_lake`
3+
```

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.2
5+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.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

+12
Original file line numberDiff line numberDiff line change
@@ -1598,3 +1598,15 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8
15981598
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
15991599
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
16001600
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
1601+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 h1:yeTuK0eMUI8FDPR4+NK0LS6rIogHkNGF3/sjws49CVk=
1602+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
1603+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 h1:yeTuK0eMUI8FDPR4+NK0LS6rIogHkNGF3/sjws49CVk=
1604+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
1605+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 h1:yeTuK0eMUI8FDPR4+NK0LS6rIogHkNGF3/sjws49CVk=
1606+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
1607+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.0 h1:ztgQd50fYLjEspg/PmO1how0Oo4asx1uN+EkV7st5X8=
1608+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
1609+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.1 h1:tOK2JMa0ioqsuG3sbe8AMzVwUTo/xM1bvUj1U0aPVXM=
1610+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.1/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
1611+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.2 h1:V2EzqYSMPUkyKTtSevKTFU0Dw7nK6uVpg40U31Y0x/8=
1612+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.2/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=

google/config.go

+1
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ type Config struct {
251251
CloudResourceManagerBasePath string
252252
ContainerAwsBasePath string
253253
ContainerAzureBasePath string
254+
DataplexBasePath string
254255
EventarcBasePath string
255256
FirebaserulesBasePath string
256257
GkeHubBasePath string

google/provider.go

+3
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ func Provider() *schema.Provider {
711711
AssuredWorkloadsEndpointEntryKey: AssuredWorkloadsEndpointEntry,
712712
ClouddeployEndpointEntryKey: ClouddeployEndpointEntry,
713713
CloudResourceManagerEndpointEntryKey: CloudResourceManagerEndpointEntry,
714+
DataplexEndpointEntryKey: DataplexEndpointEntry,
714715
EventarcEndpointEntryKey: EventarcEndpointEntry,
715716
FirebaserulesEndpointEntryKey: FirebaserulesEndpointEntry,
716717
GkeHubFeatureCustomEndpointEntryKey: GkeHubFeatureCustomEndpointEntry,
@@ -1272,6 +1273,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
12721273
"google_container_azure_client": resourceContainerAzureClient(),
12731274
"google_container_azure_cluster": resourceContainerAzureCluster(),
12741275
"google_container_azure_node_pool": resourceContainerAzureNodePool(),
1276+
"google_dataplex_lake": resourceDataplexLake(),
12751277
"google_dataproc_workflow_template": resourceDataprocWorkflowTemplate(),
12761278
"google_eventarc_trigger": resourceEventarcTrigger(),
12771279
"google_firebaserules_release": resourceFirebaserulesRelease(),
@@ -1520,6 +1522,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
15201522
config.AssuredWorkloadsBasePath = d.Get(AssuredWorkloadsEndpointEntryKey).(string)
15211523
config.ClouddeployBasePath = d.Get(ClouddeployEndpointEntryKey).(string)
15221524
config.CloudResourceManagerBasePath = d.Get(CloudResourceManagerEndpointEntryKey).(string)
1525+
config.DataplexBasePath = d.Get(DataplexEndpointEntryKey).(string)
15231526
config.EventarcBasePath = d.Get(EventarcEndpointEntryKey).(string)
15241527
config.FirebaserulesBasePath = d.Get(FirebaserulesEndpointEntryKey).(string)
15251528
config.GkeHubBasePath = d.Get(GkeHubFeatureCustomEndpointEntryKey).(string)

google/provider_dcl_client_creation.go

+24
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
compute "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/compute"
2929
containeraws "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/containeraws"
3030
containerazure "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/containerazure"
31+
dataplex "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/dataplex"
3132
dataproc "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/dataproc"
3233
eventarc "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/eventarc"
3334
firebaserules "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/firebaserules"
@@ -246,6 +247,29 @@ func NewDCLContainerAzureClient(config *Config, userAgent, billingProject string
246247
return containerazure.NewClient(dclConfig)
247248
}
248249

250+
func NewDCLDataplexClient(config *Config, userAgent, billingProject string, timeout time.Duration) *dataplex.Client {
251+
configOptions := []dcl.ConfigOption{
252+
dcl.WithHTTPClient(config.client),
253+
dcl.WithUserAgent(userAgent),
254+
dcl.WithLogger(dclLogger{}),
255+
dcl.WithBasePath(config.DataplexBasePath),
256+
}
257+
258+
if timeout != 0 {
259+
configOptions = append(configOptions, dcl.WithTimeout(timeout))
260+
}
261+
262+
if config.UserProjectOverride {
263+
configOptions = append(configOptions, dcl.WithUserProjectOverride())
264+
if billingProject != "" {
265+
configOptions = append(configOptions, dcl.WithBillingProject(billingProject))
266+
}
267+
}
268+
269+
dclConfig := dcl.NewConfig(configOptions...)
270+
return dataplex.NewClient(dclConfig)
271+
}
272+
249273
func NewDCLDataprocClient(config *Config, userAgent, billingProject string, timeout time.Duration) *dataproc.Client {
250274
configOptions := []dcl.ConfigOption{
251275
dcl.WithHTTPClient(config.client),

google/provider_dcl_endpoints.go

+12
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ var ContainerAzureEndpointEntry = &schema.Schema{
9494
}, ""),
9595
}
9696

97+
var DataplexEndpointEntryKey = "dataplex_custom_endpoint"
98+
var DataplexEndpointEntry = &schema.Schema{
99+
Type: schema.TypeString,
100+
Optional: true,
101+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
102+
"GOOGLE_DATAPLEX_CUSTOM_ENDPOINT",
103+
}, ""),
104+
}
105+
97106
var EventarcEndpointEntryKey = "eventarc_custom_endpoint"
98107
var EventarcEndpointEntry = &schema.Schema{
99108
Type: schema.TypeString,
@@ -175,6 +184,7 @@ var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
175184
//ComputeBasePath string
176185
//ContainerAwsBasePath string
177186
//ContainerAzureBasePath string
187+
//DataplexBasePath string
178188
//EventarcBasePath string
179189
//FirebaserulesBasePath string
180190
//LoggingBasePath string
@@ -193,6 +203,7 @@ var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
193203
// ComputeEndpointEntryKey: ComputeEndpointEntry,
194204
// ContainerAwsEndpointEntryKey: ContainerAwsEndpointEntry,
195205
// ContainerAzureEndpointEntryKey: ContainerAzureEndpointEntry,
206+
// DataplexEndpointEntryKey: DataplexEndpointEntry,
196207
// EventarcEndpointEntryKey: EventarcEndpointEntry,
197208
// FirebaserulesEndpointEntryKey: FirebaserulesEndpointEntry,
198209
// LoggingEndpointEntryKey: LoggingEndpointEntry,
@@ -211,6 +222,7 @@ var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
211222
// config.ComputeBasePath = d.Get(ComputeEndpointEntryKey).(string)
212223
// config.ContainerAwsBasePath = d.Get(ContainerAwsEndpointEntryKey).(string)
213224
// config.ContainerAzureBasePath = d.Get(ContainerAzureEndpointEntryKey).(string)
225+
// config.DataplexBasePath = d.Get(DataplexEndpointEntryKey).(string)
214226
// config.EventarcBasePath = d.Get(EventarcEndpointEntryKey).(string)
215227
// config.FirebaserulesBasePath = d.Get(FirebaserulesEndpointEntryKey).(string)
216228
// config.LoggingBasePath = d.Get(LoggingEndpointEntryKey).(string)

google/resource_container_aws_cluster.go

-2
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@ func ContainerAwsClusterControlPlaneSchema() *schema.Resource {
292292
"ssh_config": {
293293
Type: schema.TypeList,
294294
Optional: true,
295-
ForceNew: true,
296295
Description: "Optional. SSH configuration for how to access the underlying control plane machines.",
297296
MaxItems: 1,
298297
Elem: ContainerAwsClusterControlPlaneSshConfigSchema(),
@@ -447,7 +446,6 @@ func ContainerAwsClusterControlPlaneSshConfigSchema() *schema.Resource {
447446
"ec2_key_pair": {
448447
Type: schema.TypeString,
449448
Required: true,
450-
ForceNew: true,
451449
Description: "The name of the EC2 key pair used to login into cluster machines.",
452450
},
453451
},

google/resource_container_aws_node_pool.go

-2
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ func ContainerAwsNodePoolConfigSchema() *schema.Resource {
239239
"ssh_config": {
240240
Type: schema.TypeList,
241241
Optional: true,
242-
ForceNew: true,
243242
Description: "Optional. The SSH configuration.",
244243
MaxItems: 1,
245244
Elem: ContainerAwsNodePoolConfigSshConfigSchema(),
@@ -333,7 +332,6 @@ func ContainerAwsNodePoolConfigSshConfigSchema() *schema.Resource {
333332
"ec2_key_pair": {
334333
Type: schema.TypeString,
335334
Required: true,
336-
ForceNew: true,
337335
Description: "The name of the EC2 key pair used to login into cluster machines.",
338336
},
339337
},

0 commit comments

Comments
 (0)