Skip to content

Commit

Permalink
Add Dataplex Lake to tpg built from their DCL resources (#6055) (#11769)
Browse files Browse the repository at this point in the history
* 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 <magic-modules@google.com>
  • Loading branch information
modular-magician authored May 25, 2022
1 parent 2c39a04 commit bba3e08
Show file tree
Hide file tree
Showing 14 changed files with 934 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .changelog/6055.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
`google_dataplex_lake`
```
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/hashicorp/terraform-provider-google
require (
cloud.google.com/go/bigtable v1.13.0
cloud.google.com/go/iam v0.1.1 // indirect
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.5.2
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.2
github.com/apparentlymart/go-cidr v1.1.0
github.com/client9/misspell v0.3.4
github.com/davecgh/go-spew v1.1.1
Expand Down
12 changes: 12 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1598,3 +1598,15 @@ 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.7.0 h1:yeTuK0eMUI8FDPR4+NK0LS6rIogHkNGF3/sjws49CVk=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 h1:yeTuK0eMUI8FDPR4+NK0LS6rIogHkNGF3/sjws49CVk=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0 h1:yeTuK0eMUI8FDPR4+NK0LS6rIogHkNGF3/sjws49CVk=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.7.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.0 h1:ztgQd50fYLjEspg/PmO1how0Oo4asx1uN+EkV7st5X8=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.0/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.1 h1:tOK2JMa0ioqsuG3sbe8AMzVwUTo/xM1bvUj1U0aPVXM=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.1/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.2 h1:V2EzqYSMPUkyKTtSevKTFU0Dw7nK6uVpg40U31Y0x/8=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.8.2/go.mod h1:UJoDYx6t3+xCOd+dZX8+NrEB+Y/eW1pQlvxh2Gt7y5E=
1 change: 1 addition & 0 deletions google/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ type Config struct {
CloudResourceManagerBasePath string
ContainerAwsBasePath string
ContainerAzureBasePath string
DataplexBasePath string
EventarcBasePath string
FirebaserulesBasePath string
GkeHubBasePath string
Expand Down
3 changes: 3 additions & 0 deletions google/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ func Provider() *schema.Provider {
AssuredWorkloadsEndpointEntryKey: AssuredWorkloadsEndpointEntry,
ClouddeployEndpointEntryKey: ClouddeployEndpointEntry,
CloudResourceManagerEndpointEntryKey: CloudResourceManagerEndpointEntry,
DataplexEndpointEntryKey: DataplexEndpointEntry,
EventarcEndpointEntryKey: EventarcEndpointEntry,
FirebaserulesEndpointEntryKey: FirebaserulesEndpointEntry,
GkeHubFeatureCustomEndpointEntryKey: GkeHubFeatureCustomEndpointEntry,
Expand Down Expand Up @@ -1272,6 +1273,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_container_azure_client": resourceContainerAzureClient(),
"google_container_azure_cluster": resourceContainerAzureCluster(),
"google_container_azure_node_pool": resourceContainerAzureNodePool(),
"google_dataplex_lake": resourceDataplexLake(),
"google_dataproc_workflow_template": resourceDataprocWorkflowTemplate(),
"google_eventarc_trigger": resourceEventarcTrigger(),
"google_firebaserules_release": resourceFirebaserulesRelease(),
Expand Down Expand Up @@ -1520,6 +1522,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.AssuredWorkloadsBasePath = d.Get(AssuredWorkloadsEndpointEntryKey).(string)
config.ClouddeployBasePath = d.Get(ClouddeployEndpointEntryKey).(string)
config.CloudResourceManagerBasePath = d.Get(CloudResourceManagerEndpointEntryKey).(string)
config.DataplexBasePath = d.Get(DataplexEndpointEntryKey).(string)
config.EventarcBasePath = d.Get(EventarcEndpointEntryKey).(string)
config.FirebaserulesBasePath = d.Get(FirebaserulesEndpointEntryKey).(string)
config.GkeHubBasePath = d.Get(GkeHubFeatureCustomEndpointEntryKey).(string)
Expand Down
24 changes: 24 additions & 0 deletions google/provider_dcl_client_creation.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
compute "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/compute"
containeraws "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/containeraws"
containerazure "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/containerazure"
dataplex "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/dataplex"
dataproc "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/dataproc"
eventarc "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/eventarc"
firebaserules "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/firebaserules"
Expand Down Expand Up @@ -246,6 +247,29 @@ func NewDCLContainerAzureClient(config *Config, userAgent, billingProject string
return containerazure.NewClient(dclConfig)
}

func NewDCLDataplexClient(config *Config, userAgent, billingProject string, timeout time.Duration) *dataplex.Client {
configOptions := []dcl.ConfigOption{
dcl.WithHTTPClient(config.client),
dcl.WithUserAgent(userAgent),
dcl.WithLogger(dclLogger{}),
dcl.WithBasePath(config.DataplexBasePath),
}

if timeout != 0 {
configOptions = append(configOptions, dcl.WithTimeout(timeout))
}

if config.UserProjectOverride {
configOptions = append(configOptions, dcl.WithUserProjectOverride())
if billingProject != "" {
configOptions = append(configOptions, dcl.WithBillingProject(billingProject))
}
}

dclConfig := dcl.NewConfig(configOptions...)
return dataplex.NewClient(dclConfig)
}

func NewDCLDataprocClient(config *Config, userAgent, billingProject string, timeout time.Duration) *dataproc.Client {
configOptions := []dcl.ConfigOption{
dcl.WithHTTPClient(config.client),
Expand Down
12 changes: 12 additions & 0 deletions google/provider_dcl_endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ var ContainerAzureEndpointEntry = &schema.Schema{
}, ""),
}

var DataplexEndpointEntryKey = "dataplex_custom_endpoint"
var DataplexEndpointEntry = &schema.Schema{
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_DATAPLEX_CUSTOM_ENDPOINT",
}, ""),
}

var EventarcEndpointEntryKey = "eventarc_custom_endpoint"
var EventarcEndpointEntry = &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -175,6 +184,7 @@ var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
//ComputeBasePath string
//ContainerAwsBasePath string
//ContainerAzureBasePath string
//DataplexBasePath string
//EventarcBasePath string
//FirebaserulesBasePath string
//LoggingBasePath string
Expand All @@ -193,6 +203,7 @@ var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
// ComputeEndpointEntryKey: ComputeEndpointEntry,
// ContainerAwsEndpointEntryKey: ContainerAwsEndpointEntry,
// ContainerAzureEndpointEntryKey: ContainerAzureEndpointEntry,
// DataplexEndpointEntryKey: DataplexEndpointEntry,
// EventarcEndpointEntryKey: EventarcEndpointEntry,
// FirebaserulesEndpointEntryKey: FirebaserulesEndpointEntry,
// LoggingEndpointEntryKey: LoggingEndpointEntry,
Expand All @@ -211,6 +222,7 @@ var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
// config.ComputeBasePath = d.Get(ComputeEndpointEntryKey).(string)
// config.ContainerAwsBasePath = d.Get(ContainerAwsEndpointEntryKey).(string)
// config.ContainerAzureBasePath = d.Get(ContainerAzureEndpointEntryKey).(string)
// config.DataplexBasePath = d.Get(DataplexEndpointEntryKey).(string)
// config.EventarcBasePath = d.Get(EventarcEndpointEntryKey).(string)
// config.FirebaserulesBasePath = d.Get(FirebaserulesEndpointEntryKey).(string)
// config.LoggingBasePath = d.Get(LoggingEndpointEntryKey).(string)
Expand Down
2 changes: 0 additions & 2 deletions google/resource_container_aws_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ func ContainerAwsClusterControlPlaneSchema() *schema.Resource {
"ssh_config": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Description: "Optional. SSH configuration for how to access the underlying control plane machines.",
MaxItems: 1,
Elem: ContainerAwsClusterControlPlaneSshConfigSchema(),
Expand Down Expand Up @@ -447,7 +446,6 @@ func ContainerAwsClusterControlPlaneSshConfigSchema() *schema.Resource {
"ec2_key_pair": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "The name of the EC2 key pair used to login into cluster machines.",
},
},
Expand Down
2 changes: 0 additions & 2 deletions google/resource_container_aws_node_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ func ContainerAwsNodePoolConfigSchema() *schema.Resource {
"ssh_config": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Description: "Optional. The SSH configuration.",
MaxItems: 1,
Elem: ContainerAwsNodePoolConfigSshConfigSchema(),
Expand Down Expand Up @@ -333,7 +332,6 @@ func ContainerAwsNodePoolConfigSshConfigSchema() *schema.Resource {
"ec2_key_pair": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "The name of the EC2 key pair used to login into cluster machines.",
},
},
Expand Down
Loading

0 comments on commit bba3e08

Please sign in to comment.