Skip to content

Commit

Permalink
Add Looker product and Instance resource support (#8110) (#15188)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
Co-authored-by: Riley Karson <[email protected]>
Co-authored-by: Efe Elaiho <[email protected]>
Co-authored-by: efeelaiho <[email protected]>
  • Loading branch information
4 people authored Jul 14, 2023
1 parent 3fba8aa commit 15a5960
Show file tree
Hide file tree
Showing 15 changed files with 2,943 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/8110.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
`google_looker_instance`
```
1 change: 1 addition & 0 deletions .teamcity/components/generated/services.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ var services = mapOf(
"identityplatform" to "Identityplatform",
"kms" to "Kms",
"logging" to "Logging",
"looker" to "Looker",
"memcache" to "Memcache",
"mlengine" to "Mlengine",
"monitoring" to "Monitoring",
Expand Down
1 change: 1 addition & 0 deletions google/config_test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func configureTestBasePaths(c *transport_tpg.Config, url string) {
c.IdentityPlatformBasePath = url
c.KMSBasePath = url
c.LoggingBasePath = url
c.LookerBasePath = url
c.MemcacheBasePath = url
c.MLEngineBasePath = url
c.MonitoringBasePath = url
Expand Down
1 change: 1 addition & 0 deletions google/fwmodels/provider_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ type ProviderModel struct {
IdentityPlatformCustomEndpoint types.String `tfsdk:"identity_platform_custom_endpoint"`
KMSCustomEndpoint types.String `tfsdk:"kms_custom_endpoint"`
LoggingCustomEndpoint types.String `tfsdk:"logging_custom_endpoint"`
LookerCustomEndpoint types.String `tfsdk:"looker_custom_endpoint"`
MemcacheCustomEndpoint types.String `tfsdk:"memcache_custom_endpoint"`
MLEngineCustomEndpoint types.String `tfsdk:"ml_engine_custom_endpoint"`
MonitoringCustomEndpoint types.String `tfsdk:"monitoring_custom_endpoint"`
Expand Down
6 changes: 6 additions & 0 deletions google/fwprovider/framework_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,12 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
transport_tpg.CustomEndpointValidator(),
},
},
"looker_custom_endpoint": &schema.StringAttribute{
Optional: true,
Validators: []validator.String{
transport_tpg.CustomEndpointValidator(),
},
},
"memcache_custom_endpoint": &schema.StringAttribute{
Optional: true,
Validators: []validator.String{
Expand Down
10 changes: 10 additions & 0 deletions google/fwtransport/framework_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ type FrameworkProviderConfig struct {
IdentityPlatformBasePath string
KMSBasePath string
LoggingBasePath string
LookerBasePath string
MemcacheBasePath string
MLEngineBasePath string
MonitoringBasePath string
Expand Down Expand Up @@ -244,6 +245,7 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context,
p.IdentityPlatformBasePath = data.IdentityPlatformCustomEndpoint.ValueString()
p.KMSBasePath = data.KMSCustomEndpoint.ValueString()
p.LoggingBasePath = data.LoggingCustomEndpoint.ValueString()
p.LookerBasePath = data.LookerCustomEndpoint.ValueString()
p.MemcacheBasePath = data.MemcacheCustomEndpoint.ValueString()
p.MLEngineBasePath = data.MLEngineCustomEndpoint.ValueString()
p.MonitoringBasePath = data.MonitoringCustomEndpoint.ValueString()
Expand Down Expand Up @@ -891,6 +893,14 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo
data.LoggingCustomEndpoint = types.StringValue(customEndpoint.(string))
}
}
if data.LookerCustomEndpoint.IsNull() {
customEndpoint := transport_tpg.MultiEnvDefault([]string{
"GOOGLE_LOOKER_CUSTOM_ENDPOINT",
}, transport_tpg.DefaultBasePaths[transport_tpg.LookerBasePathKey])
if customEndpoint != nil {
data.LookerCustomEndpoint = types.StringValue(customEndpoint.(string))
}
}
if data.MemcacheCustomEndpoint.IsNull() {
customEndpoint := transport_tpg.MultiEnvDefault([]string{
"GOOGLE_MEMCACHE_CUSTOM_ENDPOINT",
Expand Down
1 change: 1 addition & 0 deletions google/gcp_sweeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import (
_ "github.com/hashicorp/terraform-provider-google/google/services/identityplatform"
_ "github.com/hashicorp/terraform-provider-google/google/services/kms"
_ "github.com/hashicorp/terraform-provider-google/google/services/logging"
_ "github.com/hashicorp/terraform-provider-google/google/services/looker"
_ "github.com/hashicorp/terraform-provider-google/google/services/memcache"
_ "github.com/hashicorp/terraform-provider-google/google/services/mlengine"
_ "github.com/hashicorp/terraform-provider-google/google/services/monitoring"
Expand Down
12 changes: 10 additions & 2 deletions google/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import (
"github.com/hashicorp/terraform-provider-google/google/services/identityplatform"
"github.com/hashicorp/terraform-provider-google/google/services/kms"
"github.com/hashicorp/terraform-provider-google/google/services/logging"
"github.com/hashicorp/terraform-provider-google/google/services/looker"
"github.com/hashicorp/terraform-provider-google/google/services/memcache"
"github.com/hashicorp/terraform-provider-google/google/services/mlengine"
"github.com/hashicorp/terraform-provider-google/google/services/monitoring"
Expand Down Expand Up @@ -527,6 +528,11 @@ func Provider() *schema.Provider {
Optional: true,
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
},
"looker_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
},
"memcache_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -939,9 +945,9 @@ func DatasourceMapWithErrors() (map[string]*schema.Resource, error) {
})
}

// Generated resources: 300
// Generated resources: 301
// Generated IAM resources: 198
// Total generated resources: 498
// Total generated resources: 499
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -1327,6 +1333,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_logging_linked_dataset": logging.ResourceLoggingLinkedDataset(),
"google_logging_log_view": logging.ResourceLoggingLogView(),
"google_logging_metric": logging.ResourceLoggingMetric(),
"google_looker_instance": looker.ResourceLookerInstance(),
"google_memcache_instance": memcache.ResourceMemcacheInstance(),
"google_ml_engine_model": mlengine.ResourceMLEngineModel(),
"google_monitoring_alert_policy": monitoring.ResourceMonitoringAlertPolicy(),
Expand Down Expand Up @@ -1734,6 +1741,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.IdentityPlatformBasePath = d.Get("identity_platform_custom_endpoint").(string)
config.KMSBasePath = d.Get("kms_custom_endpoint").(string)
config.LoggingBasePath = d.Get("logging_custom_endpoint").(string)
config.LookerBasePath = d.Get("looker_custom_endpoint").(string)
config.MemcacheBasePath = d.Get("memcache_custom_endpoint").(string)
config.MLEngineBasePath = d.Get("ml_engine_custom_endpoint").(string)
config.MonitoringBasePath = d.Get("monitoring_custom_endpoint").(string)
Expand Down
Loading

0 comments on commit 15a5960

Please sign in to comment.