Skip to content

Commit

Permalink
Merge pull request #3982 from kaofelix/route53-zone-import-bug
Browse files Browse the repository at this point in the history
Fix bug: route53_zone import saves name with trailing . in state causing plan to detect a change and try to recreate the zone
  • Loading branch information
bflad authored Apr 10, 2018
2 parents 6bd0b67 + 1959801 commit 33ca6e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions aws/diff_suppress_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, ".")
}
7 changes: 4 additions & 3 deletions aws/resource_aws_route53_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 33ca6e8

Please sign in to comment.