diff --git a/products/cloudrun/terraform.yaml b/products/cloudrun/terraform.yaml index 1c085b1e553d..7c50a4845386 100644 --- a/products/cloudrun/terraform.yaml +++ b/products/cloudrun/terraform.yaml @@ -57,6 +57,8 @@ overrides: !ruby/object:Overrides::ResourceOverrides spec.routeName: !ruby/object:Overrides::Terraform::PropertyOverride custom_expand: 'templates/terraform/custom_expand/resource_from_self_link.go.erb' diff_suppress_func: 'compareSelfLinkOrResourceName' + spec.forceOverride: !ruby/object:Overrides::Terraform::PropertyOverride + custom_flatten: templates/terraform/custom_flatten/cloudrun_ignore_force_override.go.erb Service: !ruby/object:Overrides::Terraform::ResourceOverride id_format: "locations/{{location}}/namespaces/{{project}}/services/{{name}}" import_format: ["locations/{{location}}/namespaces/{{project}}/services/{{name}}"] diff --git a/templates/terraform/custom_flatten/cloudrun_ignore_force_override.go.erb b/templates/terraform/custom_flatten/cloudrun_ignore_force_override.go.erb new file mode 100644 index 000000000000..36fcbbe1c97a --- /dev/null +++ b/templates/terraform/custom_flatten/cloudrun_ignore_force_override.go.erb @@ -0,0 +1,18 @@ +<%# The license inside this block applies to this file. + # Copyright 2020 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. +-%> +func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *Config) interface{} { + // We want to ignore read on this field, but cannot because it is nested + return d.Get("spec.0.force_override") +} \ No newline at end of file diff --git a/templates/terraform/examples/cloud_run_domain_mapping_basic.tf.erb b/templates/terraform/examples/cloud_run_domain_mapping_basic.tf.erb index bf58553d396b..408108952843 100644 --- a/templates/terraform/examples/cloud_run_domain_mapping_basic.tf.erb +++ b/templates/terraform/examples/cloud_run_domain_mapping_basic.tf.erb @@ -22,9 +22,6 @@ resource "google_cloud_run_domain_mapping" "<%= ctx[:primary_resource_id] %>" { metadata { namespace = "<%= ctx[:test_env_vars]['namespace'] %>" - annotations = { - "run.googleapis.com/launch-stage" = "BETA" - } } spec {