From 4f6d7d8b34aafc9ff57ad0592bb1d431feee9d34 Mon Sep 17 00:00:00 2001 From: Megan Bang Date: Wed, 4 Sep 2019 16:38:09 -0500 Subject: [PATCH] switch diff suppress to default_from_api --- products/compute/terraform.yaml | 3 +-- templates/terraform/constants/address.go.erb | 14 -------------- 2 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 templates/terraform/constants/address.go.erb diff --git a/products/compute/terraform.yaml b/products/compute/terraform.yaml index 71ac609cf085..85a5445749bb 100644 --- a/products/compute/terraform.yaml +++ b/products/compute/terraform.yaml @@ -46,7 +46,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides addressType: !ruby/object:Overrides::Terraform::PropertyOverride custom_flatten: 'templates/terraform/custom_flatten/default_if_empty.erb' purpose: !ruby/object:Overrides::Terraform::PropertyOverride - diff_suppress_func: addressDiffSuppress + default_from_api: true id: !ruby/object:Overrides::Terraform::PropertyOverride exclude: true labelFingerprint: !ruby/object:Overrides::Terraform::PropertyOverride @@ -70,7 +70,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides * `address` - The IP of the created resource. custom_code: !ruby/object:Provider::Terraform::CustomCode post_create: templates/terraform/post_create/labels.erb - constants: templates/terraform/constants/address.go.erb Autoscaler: !ruby/object:Overrides::Terraform::ResourceOverride id_format: "{{zone}}/{{name}}" examples: diff --git a/templates/terraform/constants/address.go.erb b/templates/terraform/constants/address.go.erb deleted file mode 100644 index 3835e321f34d..000000000000 --- a/templates/terraform/constants/address.go.erb +++ /dev/null @@ -1,14 +0,0 @@ -// All internal addresses default to a purpose of `GCE_ENDPOINT`, but it is not -// allowed on external addresses, so we can't set the default on the field. -func addressDiffSuppress(k, old, new string, d *schema.ResourceData) bool { - if k == "purpose" { - addressType := d.Get("address_type") - - if addressType == "INTERNAL" && old == "GCE_ENDPOINT" && - new == "" { - return true - } - } - - return false -}