Skip to content

Commit

Permalink
Correct Cloud Run DomainMapping namespace in encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
rileykarson committed Oct 10, 2019
1 parent be81b7d commit b81b4cd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
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 b81b4cd

Please sign in to comment.