From 19598013a34aa323463b91845ce76541570fa911 Mon Sep 17 00:00:00 2001 From: kaofelix Date: Thu, 29 Mar 2018 22:03:12 +0200 Subject: [PATCH] Fix bug: route53_zone import saves name with trailing . in state --- aws/diff_suppress_funcs.go | 4 ++++ aws/resource_aws_route53_zone.go | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/aws/diff_suppress_funcs.go b/aws/diff_suppress_funcs.go index d891708b918..cc33eab36b4 100644 --- a/aws/diff_suppress_funcs.go +++ b/aws/diff_suppress_funcs.go @@ -85,3 +85,7 @@ func suppressAutoscalingGroupAvailabilityZoneDiffs(k, old, new string, d *schema return false } + +func suppressRoute53ZoneNameWithTrailingDot(k, old, new string, d *schema.ResourceData) bool { + return strings.TrimSuffix(old, ".") == strings.TrimSuffix(new, ".") +} diff --git a/aws/resource_aws_route53_zone.go b/aws/resource_aws_route53_zone.go index 0373db6727b..be92b325ae2 100644 --- a/aws/resource_aws_route53_zone.go +++ b/aws/resource_aws_route53_zone.go @@ -28,9 +28,10 @@ func resourceAwsRoute53Zone() *schema.Resource { Schema: map[string]*schema.Schema{ "name": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + DiffSuppressFunc: suppressRoute53ZoneNameWithTrailingDot, }, "comment": &schema.Schema{