diff --git a/builtin/providers/aws/resource_aws_route53_record.go b/builtin/providers/aws/resource_aws_route53_record.go index bbf3d6fef716..a9884d8fafe5 100644 --- a/builtin/providers/aws/resource_aws_route53_record.go +++ b/builtin/providers/aws/resource_aws_route53_record.go @@ -18,6 +18,7 @@ func resourceAwsRoute53Record() *schema.Resource { return &schema.Resource{ Create: resourceAwsRoute53RecordCreate, Read: resourceAwsRoute53RecordRead, + Update: resourceAwsRoute53RecordUpdate, Delete: resourceAwsRoute53RecordDelete, Schema: map[string]*schema.Schema{ @@ -42,14 +43,12 @@ func resourceAwsRoute53Record() *schema.Resource { "ttl": &schema.Schema{ Type: schema.TypeInt, Required: true, - ForceNew: true, }, "records": &schema.Schema{ Type: schema.TypeSet, Elem: &schema.Schema{Type: schema.TypeString}, Required: true, - ForceNew: true, Set: func(v interface{}) int { return hashcode.String(v.(string)) }, @@ -58,6 +57,19 @@ func resourceAwsRoute53Record() *schema.Resource { } } +func resourceAwsRoute53RecordUpdate(d *schema.ResourceData, meta interface{}) error { + // Route 53 supports CREATE, DELETE, and UPSERT actions. We use UPSERT, and + // AWS dynamically determines if a record should be created or updated. + // Amazon Route 53 can update an existing resource record set only when all + // of the following values match: Name, Type + // (and SetIdentifier, which we don't use yet). + // See http://docs.aws.amazon.com/Route53/latest/APIReference/API_ChangeResourceRecordSets_Requests.html#change-rrsets-request-action + // + // Because we use UPSERT, for resouce update here we simply fall through to + // our resource create function. + return resourceAwsRoute53RecordCreate(d, meta) +} + func resourceAwsRoute53RecordCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).r53conn zone := cleanZoneID(d.Get("zone_id").(string))