From 21a38f4d75d2baf26ed4ef851a91d3294dd6b38f Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Thu, 5 Dec 2019 20:59:48 +0000 Subject: [PATCH] Add support for cloud run service IAM. Use base paths via replaceVars Signed-off-by: Modular Magician --- google/cloudrun_domain_mapping.go | 6 +++--- google/cloudrun_service.go | 6 +++--- google/config.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/google/cloudrun_domain_mapping.go b/google/cloudrun_domain_mapping.go index 6afdc3c0e..250dd565d 100644 --- a/google/cloudrun_domain_mapping.go +++ b/google/cloudrun_domain_mapping.go @@ -20,7 +20,7 @@ import ( ) func GetCloudRunDomainMappingCaiObject(d TerraformResourceData, config *Config) (Asset, error) { - name, err := assetName(d, config, "//cloudrun.googleapis.com/domains.cloudrun.com/v1/namespaces/{{project}}/domainmappings/{{name}}") + name, err := assetName(d, config, "//cloudrun.googleapis.com/apis/domains.cloudrun.com/v1/namespaces/{{project}}/domainmappings/{{name}}") if err != nil { return Asset{}, err } @@ -29,8 +29,8 @@ func GetCloudRunDomainMappingCaiObject(d TerraformResourceData, config *Config) Name: name, Type: "cloudrun.googleapis.com/DomainMapping", Resource: &AssetResource{ - Version: "apis", - DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/cloudrun/apis/rest", + Version: "{{location}}-run.googleapis.com", + DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/cloudrun/{{location}}-run.googleapis.com/rest", DiscoveryName: "DomainMapping", Data: obj, }, diff --git a/google/cloudrun_service.go b/google/cloudrun_service.go index fa624f9ce..37348164f 100644 --- a/google/cloudrun_service.go +++ b/google/cloudrun_service.go @@ -17,7 +17,7 @@ package google import "reflect" func GetCloudRunServiceCaiObject(d TerraformResourceData, config *Config) (Asset, error) { - name, err := assetName(d, config, "//cloudrun.googleapis.com/serving.knative.dev/v1/namespaces/{{project}}/services/{{name}}") + name, err := assetName(d, config, "//cloudrun.googleapis.com/apis/serving.knative.dev/v1/namespaces/{{project}}/services/{{name}}") if err != nil { return Asset{}, err } @@ -26,8 +26,8 @@ func GetCloudRunServiceCaiObject(d TerraformResourceData, config *Config) (Asset Name: name, Type: "cloudrun.googleapis.com/Service", Resource: &AssetResource{ - Version: "apis", - DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/cloudrun/apis/rest", + Version: "{{location}}-run.googleapis.com", + DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/cloudrun/{{location}}-run.googleapis.com/rest", DiscoveryName: "Service", Data: obj, }, diff --git a/google/config.go b/google/config.go index da68cc37e..df975c6d0 100644 --- a/google/config.go +++ b/google/config.go @@ -207,7 +207,7 @@ var BigtableDefaultBasePath = "https://bigtableadmin.googleapis.com/v2/" var BinaryAuthorizationDefaultBasePath = "https://binaryauthorization.googleapis.com/v1/" var CloudBuildDefaultBasePath = "https://cloudbuild.googleapis.com/v1/" var CloudFunctionsDefaultBasePath = "https://cloudfunctions.googleapis.com/v1/" -var CloudRunDefaultBasePath = "https://{{location}}-run.googleapis.com/apis/" +var CloudRunDefaultBasePath = "https://{{location}}-run.googleapis.com/" var CloudSchedulerDefaultBasePath = "https://cloudscheduler.googleapis.com/v1/" var CloudTasksDefaultBasePath = "https://cloudtasks.googleapis.com/v2/" var ComputeDefaultBasePath = "https://www.googleapis.com/compute/v1/"