Skip to content

Commit

Permalink
Correct Cloud Run DomainMapping namespace in encoder (#2458)
Browse files Browse the repository at this point in the history
Merged PR #2458.
  • Loading branch information
rileykarson authored and modular-magician committed Oct 10, 2019
1 parent d005b16 commit 6cd5b8b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build/terraform
2 changes: 1 addition & 1 deletion build/terraform-beta
4 changes: 2 additions & 2 deletions products/cloudrun/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions templates/terraform/encoders/cloud_run_domain_mapping.go.erb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 6cd5b8b

Please sign in to comment.