From f8b05fa05e78b29c913fd205d17e43215caf7f0d Mon Sep 17 00:00:00 2001 From: Luke Amdor Date: Wed, 15 Apr 2015 16:10:02 -0500 Subject: [PATCH] using a set for route53 name_servers --- builtin/providers/aws/resource_aws_route53_zone.go | 6 +++++- builtin/providers/aws/resource_aws_route53_zone_test.go | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/builtin/providers/aws/resource_aws_route53_zone.go b/builtin/providers/aws/resource_aws_route53_zone.go index eabec81e8..c85577073 100644 --- a/builtin/providers/aws/resource_aws_route53_zone.go +++ b/builtin/providers/aws/resource_aws_route53_zone.go @@ -6,6 +6,7 @@ import ( "strings" "time" + "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" @@ -33,9 +34,12 @@ func resourceAwsRoute53Zone() *schema.Resource { }, "name_servers": &schema.Schema{ - Type: schema.TypeList, + Type: schema.TypeSet, Elem: &schema.Schema{Type: schema.TypeString}, Computed: true, + Set: func(v interface{}) int { + return hashcode.String(v.(string)) + }, }, "tags": tagsSchema(), diff --git a/builtin/providers/aws/resource_aws_route53_zone_test.go b/builtin/providers/aws/resource_aws_route53_zone_test.go index dcadf575c..e00b50ee6 100644 --- a/builtin/providers/aws/resource_aws_route53_zone_test.go +++ b/builtin/providers/aws/resource_aws_route53_zone_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -115,8 +116,8 @@ func testAccCheckRoute53ZoneExists(n string, zone *route53.HostedZone) resource. return fmt.Errorf("Hosted zone err: %v", err) } - for i, ns := range resp.DelegationSet.NameServers { - attribute := fmt.Sprintf("name_servers.%d", i) + for _, ns := range resp.DelegationSet.NameServers { + attribute := fmt.Sprintf("name_servers.%d", hashcode.String(ns)) dsns := rs.Primary.Attributes[attribute] if dsns != ns { return fmt.Errorf("Got: %v for %v, Expected: %v", dsns, attribute, ns)