From 6cd5b8b51b3cc1f661c148829a8563900dcccee3 Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Thu, 10 Oct 2019 14:46:24 -0700 Subject: [PATCH] Correct Cloud Run DomainMapping namespace in encoder (#2458) Merged PR #2458. --- build/terraform | 2 +- build/terraform-beta | 2 +- products/cloudrun/terraform.yaml | 4 ++-- .../encoders/cloud_run_domain_mapping.go.erb | 22 +++++++++++++++++++ ...ud_run.go.erb => cloud_run_service.go.erb} | 0 5 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 templates/terraform/encoders/cloud_run_domain_mapping.go.erb rename templates/terraform/encoders/{cloud_run.go.erb => cloud_run_service.go.erb} (100%) diff --git a/build/terraform b/build/terraform index 9ed6246593b9..b15b6a6e193b 160000 --- a/build/terraform +++ b/build/terraform @@ -1 +1 @@ -Subproject commit 9ed6246593b9f1151f46ad00c23951cea31c40f0 +Subproject commit b15b6a6e193b931c16b6741900f3de2b93a433d7 diff --git a/build/terraform-beta b/build/terraform-beta index 1b2c16107457..a71ed23efd91 160000 --- a/build/terraform-beta +++ b/build/terraform-beta @@ -1 +1 @@ -Subproject commit 1b2c161074579930ff46a591eab325d0f6ed7e64 +Subproject commit a71ed23efd910dc22efc13c3621165905963a41e diff --git a/products/cloudrun/terraform.yaml b/products/cloudrun/terraform.yaml index ee64ce02f6c8..ae8bb89df7ac 100644 --- a/products/cloudrun/terraform.yaml +++ b/products/cloudrun/terraform.yaml @@ -24,7 +24,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides test_env_vars: namespace: :PROJECT_NAME custom_code: !ruby/object:Provider::Terraform::CustomCode - encoder: 'templates/terraform/encoders/cloud_run.go.erb' + encoder: 'templates/terraform/encoders/cloud_run_domain_mapping.go.erb' decoder: 'templates/terraform/decoders/cloud_run.go.erb' properties: name: !ruby/object:Overrides::Terraform::PropertyOverride @@ -53,7 +53,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides test_env_vars: namespace: :PROJECT_NAME custom_code: !ruby/object:Provider::Terraform::CustomCode - encoder: 'templates/terraform/encoders/cloud_run.go.erb' + encoder: 'templates/terraform/encoders/cloud_run_service.go.erb' decoder: 'templates/terraform/decoders/cloud_run.go.erb' properties: name: !ruby/object:Overrides::Terraform::PropertyOverride diff --git a/templates/terraform/encoders/cloud_run_domain_mapping.go.erb b/templates/terraform/encoders/cloud_run_domain_mapping.go.erb new file mode 100644 index 000000000000..195f26b2b445 --- /dev/null +++ b/templates/terraform/encoders/cloud_run_domain_mapping.go.erb @@ -0,0 +1,22 @@ +<%# The license inside this block applies to this file. + # Copyright 2019 Google Inc. + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. +-%> +name := d.Get("name").(string) +metadata := obj["metadata"].(map[string]interface{}) +metadata["name"] = name + +// The only acceptable version/kind right now +obj["apiVersion"] = "domains.cloudrun.com/v1alpha1" +obj["kind"] = "<%= "#{object.name}" -%>" +return obj, nil diff --git a/templates/terraform/encoders/cloud_run.go.erb b/templates/terraform/encoders/cloud_run_service.go.erb similarity index 100% rename from templates/terraform/encoders/cloud_run.go.erb rename to templates/terraform/encoders/cloud_run_service.go.erb