Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support location in google tags tag binding #5115

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/6716.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
`google_tags_location_tag_bindings`
```
4 changes: 4 additions & 0 deletions google-beta/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ type Config struct {
CloudIoTBasePath string
ServiceNetworkingBasePath string
BigtableAdminBasePath string
TagsLocationBasePath string

// dcl
ContainerAwsBasePath string
Expand Down Expand Up @@ -393,6 +394,7 @@ const ServiceNetworkingBasePathKey = "ServiceNetworking"
const BigtableAdminBasePathKey = "BigtableAdmin"
const ContainerAwsBasePathKey = "ContainerAws"
const ContainerAzureBasePathKey = "ContainerAzure"
const TagsLocationBasePathKey = "TagsLocation"

// Generated product base paths
var DefaultBasePaths = map[string]string{
Expand Down Expand Up @@ -502,6 +504,7 @@ var DefaultBasePaths = map[string]string{
BigtableAdminBasePathKey: "https://bigtableadmin.googleapis.com/v2/",
ContainerAwsBasePathKey: "https://{{location}}-gkemulticloud.googleapis.com/v1/",
ContainerAzureBasePathKey: "https://{{location}}-gkemulticloud.googleapis.com/v1/",
TagsLocationBasePathKey: "https://{{location}}-cloudresourcemanager.googleapis.com/v3/",
}

var DefaultClientScopes = []string{
Expand Down Expand Up @@ -1389,4 +1392,5 @@ func ConfigureBasePaths(c *Config) {
c.ServiceNetworkingBasePath = DefaultBasePaths[ServiceNetworkingBasePathKey]
c.BigQueryBasePath = DefaultBasePaths[BigQueryBasePathKey]
c.BigtableAdminBasePath = DefaultBasePaths[BigtableAdminBasePathKey]
c.TagsLocationBasePath = DefaultBasePaths[TagsLocationBasePathKey]
}
3 changes: 3 additions & 0 deletions google-beta/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,7 @@ func Provider() *schema.Provider {
ServiceNetworkingCustomEndpointEntryKey: ServiceNetworkingCustomEndpointEntry,
ServiceUsageCustomEndpointEntryKey: ServiceUsageCustomEndpointEntry,
BigtableAdminCustomEndpointEntryKey: BigtableAdminCustomEndpointEntry,
TagsLocationCustomEndpointEntryKey: TagsLocationCustomEndpointEntry,

// dcl
ContainerAwsCustomEndpointEntryKey: ContainerAwsCustomEndpointEntry,
Expand Down Expand Up @@ -1674,6 +1675,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_storage_default_object_acl": resourceStorageDefaultObjectAcl(),
"google_storage_notification": resourceStorageNotification(),
"google_storage_transfer_job": resourceStorageTransferJob(),
"google_tags_location_tag_binding": resourceTagsLocationTagBinding(),
// ####### END handwritten resources ###########
},
map[string]*schema.Resource{
Expand Down Expand Up @@ -1933,6 +1935,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.ServiceNetworkingBasePath = d.Get(ServiceNetworkingCustomEndpointEntryKey).(string)
config.ServiceUsageBasePath = d.Get(ServiceUsageCustomEndpointEntryKey).(string)
config.BigtableAdminBasePath = d.Get(BigtableAdminCustomEndpointEntryKey).(string)
config.TagsLocationBasePath = d.Get(TagsLocationCustomEndpointEntryKey).(string)

// dcl
config.ContainerAwsBasePath = d.Get(ContainerAwsCustomEndpointEntryKey).(string)
Expand Down
10 changes: 10 additions & 0 deletions google-beta/provider_handwritten_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,16 @@ var ContainerAzureCustomEndpointEntry = &schema.Schema{
}, DefaultBasePaths[ContainerAzureBasePathKey]),
}

var TagsLocationCustomEndpointEntryKey = "tags_location_custom_endpoint"
var TagsLocationCustomEndpointEntry = &schema.Schema{
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateCustomEndpoint,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_TAGS_LOCATION_CUSTOM_ENDPOINT",
}, DefaultBasePaths[TagsLocationBasePathKey]),
}

func validateCustomEndpoint(v interface{}, k string) (ws []string, errors []error) {
re := `.*/[^/]+/$`
return validateRegexp(re)(v, k)
Expand Down
Loading