Skip to content

Commit

Permalink
Support location in google tags tag binding (#6716) (#5115)
Browse files Browse the repository at this point in the history
* working on tags issue

* added handwritten resource for location_tags

* reverting_ruby_version

* fixing_the_test_of_location_tag_binding

* fixing_the_test_og_tags_location_tag_binding

* fixing the test case of location_tag_binding

* fixing the test case of location tag binding

* fix_the_test_case_of_location_tag_binding

* fixing_the_test_and_added_different_destroy_producer

* fixing_the_test_case_of_location_tag_binding

* reverting some changes in test case

* adding new test file for location tag binding

* added a seprate test file for location tag binding

* added autogen exception in test file of location tag binding

* making_GA_only_resource_tags_location_tag_binding

* adding the test in common test file

* changing the test config in acceptance test of location_tag_binding

* minor fixes

* fixing the linting error

* minor fixes

* minor fixes

* committing to run pipeline

* reverting-ruby-version

* running pipline for debugging

* changin the IAM permission in tags test

* added permission for cloud run instance

* added permission for cloud run instance

* added permission for cloud run instance in acceptance test

* adding IAM policy to test case of location_tags_binding

* changing the IAM  role in test case of location_tag_binding

* adding the iam binding for cloudrun service in the test case of location_tag_binding

* minor fixes

* minor fixes

* minor fixes

* minor fixes

* minor fixes

* minor fixes

* minor fixes

* minor fixes

* minor fixes

* minor fixes

* minor fixes

* minor fixes

* minor fixes

* minor fixes

* re-running the pipeline

* minor linting fixes

* added the docs

* handling pagination in Read method of resource

* fixing linting errors

* minor fixes

* fixing the minor errors

* fixing the minor errors

* changing the id format

* fixing import function

* updating the docs

* fixing linting error

* fixing linting error

* fixing the import statement

* minor fixes and adding import_state_verify

* minor fix

* addressing the review comments

* addressing the review comments

* commiting to run pipeline

Signed-off-by: Modular Magician <[email protected]>

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Jan 19, 2023
1 parent 2efb939 commit d9ddfef
Show file tree
Hide file tree
Showing 8 changed files with 561 additions and 1 deletion.
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

0 comments on commit d9ddfef

Please sign in to comment.