diff --git a/aws/resource_aws_route53_record.go b/aws/resource_aws_route53_record.go index 3c8e73e07400..ae3d6685b0ae 100644 --- a/aws/resource_aws_route53_record.go +++ b/aws/resource_aws_route53_record.go @@ -235,9 +235,10 @@ func resourceAwsRoute53Record() *schema.Resource { }, "allow_overwrite": { - Type: schema.TypeBool, - Optional: true, - Default: true, + Type: schema.TypeBool, + Optional: true, + Computed: true, + Deprecated: "The next major version of the Terraform AWS Provider will require importing existing records", }, }, } diff --git a/website/docs/guides/version-2-upgrade.html.md b/website/docs/guides/version-2-upgrade.html.md index 7fa771d04e53..2a024c9c9f21 100644 --- a/website/docs/guides/version-2-upgrade.html.md +++ b/website/docs/guides/version-2-upgrade.html.md @@ -24,6 +24,7 @@ Upgrade topics: - [Data Source: aws_ami_ids](#data-source-aws_ami_ids) - [Data Source: aws_iam_role](#data-source-aws_iam_role) - [Data Source: aws_kms_secret](#data-source-aws_kms_secret) +- [Data Source: aws_lambda_function](#data-source-aws_lambda_function) - [Data Source: aws_region](#data-source-aws_region) - [Resource: aws_api_gateway_api_key](#resource-aws_api_gateway_api_key) - [Resource: aws_api_gateway_integration](#resource-aws_api_gateway_integration) @@ -44,6 +45,7 @@ Upgrade topics: - [Resource: aws_network_acl](#resource-aws_network_acl) - [Resource: aws_redshift_cluster](#resource-aws_redshift_cluster) - [Resource: aws_route_table](#resource-aws_route_table) +- [Resource: aws_route53_record](#resource-aws_route53_record) - [Resource: aws_route53_zone](#resource-aws_route53_zone) - [Resource: aws_wafregional_byte_match_set](#resource-aws_wafregional_byte_match_set) @@ -644,6 +646,31 @@ Previously, importing this resource resulted in an `aws_route` resource for each addition to the `aws_route_table`, in the Terraform state. Support for importing `aws_route` resources has been added and importing this resource only adds the `aws_route_table` resource, with in-line routes, to the state. +## Resource: aws_route53_record + +### allow_overwrite Default Value Change + +The resource now requires existing Route 53 Records to be imported into the Terraform state for management unless the `allow_overwrite` argument is enabled. The `allow_overwrite` flag is considered deprecated for removal in a future major version of the Terraform AWS Provider. + +For example, if the `www.example.com` Route 53 Record in the `example.com` Route 53 Hosted Zone existed previously and this new Terraform configuration was introduced: + +```hcl +resource "aws_route53_record" "www" { + # ... other configuration ... + name = "www.example.com" +} +``` + +During resource creation in version 1.X and prior, it would silently perform an `UPSERT` changeset to the existing Route 53 Record and not report back an error. In version 2.0.0 of the Terraform AWS Provider, the resource now performs a `CREATE` changeset, which will error for existing Route 53 Records. + +The `allow_overwrite` argument provides a temporary workaround to keep the old behavior, but existing workflows should be updated to perform a `terraform import` command like the following instead: + +```console +$ terraform import aws_route53_record.www ZONEID_www.example.com_TYPE +``` + +More information can be found in the [`aws_route53_record` resource documentation](https://www.terraform.io/docs/providers/aws/r/route53_record.html#import). + ## Resource: aws_route53_zone ### vpc_id and vpc_region Argument Removal diff --git a/website/docs/r/route53_record.html.markdown b/website/docs/r/route53_record.html.markdown index a4729b33a22e..96ff4c3aaee3 100644 --- a/website/docs/r/route53_record.html.markdown +++ b/website/docs/r/route53_record.html.markdown @@ -108,7 +108,7 @@ The following arguments are supported: * `latency_routing_policy` - (Optional) A block indicating a routing policy based on the latency between the requestor and an AWS region. Conflicts with any other routing policy. Documented below. * `weighted_routing_policy` - (Optional) A block indicating a weighted routing policy. Conflicts with any other routing policy. Documented below. * `multivalue_answer_routing_policy` - (Optional) Set to `true` to indicate a multivalue answer routing policy. Conflicts with any other routing policy. -* `allow_overwrite` - (Optional) Allow creation of this record in Terraform to overwrite an existing record, if any. This does not prevent other resources within Terraform or manual Route53 changes from overwriting this record. `true` by default. +* `allow_overwrite` - (Optional, **DEPRECATED**) Allow creation of this record in Terraform to overwrite an existing record, if any. This does not affect the ability to update the record in Terraform and does not prevent other resources within Terraform or manual Route 53 changes outside Terraform from overwriting this record. `false` by default. The next major version of the Terraform AWS Provider will always require importing existing Route 53 Records. Exactly one of `records` or `alias` must be specified: this determines whether it's an alias record.