Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Provider cannot delete a Route53 SOA record if it is an updated one (bug introduced in v51.0) #37863

Closed
mjheitland opened this issue Jun 6, 2024 · 6 comments
Assignees
Labels
bug Addresses a defect in current functionality. service/route53 Issues and PRs that pertain to the route53 service.
Milestone

Comments

@mjheitland
Copy link

Terraform Core Version

1.5.7

AWS Provider Version

5.51.0, 5.52.0

Affected Resource(s)

aws_route53_record

Expected Behavior

terraform destroy should delete Route53 SOA record that was once updated

Actual Behavior

terraform destroy fails during deletion

Relevant Error/Panic Output Snippet

Plan: 0 to add, 0 to change, 2 to destroy.
aws_route53_record.public_hosted_zone_soa: Destroying... [id=Z0445041PSEGKXJCF4XF_comservice-99-9999999999.aws.lpsolutions.com_SOA]
╷
│ Error: deleting Route53 Record (Z0445041PSEGKXJCF4XF_comservice-99-9999999999.aws.lpsolutions.com_SOA): operation error Route 53: ChangeResourceRecordSets, https response error StatusCode: 400, RequestID: fbced44d-4b8d-4d8c-bc11-f40bf15a2c59, InvalidChangeBatch: [A HostedZone must contain exactly one SOA record.]

Terraform Configuration Files

terraform {
  required_version = "~> 1.5.0"

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "5.51 # workaround:      version = ">= 5.0, < 5.51" # 5.51 introduced a bug: Route53 SOA records cannot be deleted any longer! Please update this constraint once the bug is resolved.
    }
  }
}

provider "aws" {
  region = "eu-central-1"
  default_tags {
    tags = {
      Project      = "tftest"
      Environment  = "saas-dev"
      "managed-by" = "terraform"
    }
  }
}

resource "aws_route53_zone" "public_hosted_zone" {
  name = "comservice-99-9999999999.aws.lpsolutions.com"
}

resource "aws_route53_record" "public_hosted_zone_soa" {
  allow_overwrite = true
  zone_id         = aws_route53_zone.public_hosted_zone.id
  name            = aws_route53_zone.public_hosted_zone.name
  type            = "SOA"
  ttl             = 900

  //noinspection HILUnresolvedReference
  records = [
    # [authority-domain] [hostmaster-email-address] [zone-serial-number] [refresh-time] [retry-time] [expire-time] [negative caching TTL]
    format("%s. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 60", aws_route53_zone.public_hosted_zone.primary_name_server)
  ]
}

Steps to Reproduce

  1. set your AWS credentials
  2. copy the attached configuration into an empty folder, navigate into the folder
  3. rm -rf .terraform
  4. set constraint to aws provider version that you want to test (e.g. v
  5. terraform init
  6. terraform apply # will succeed
  7. terraform destroy # will return an error if the provider version is still buggy

Debug Output

No response

Panic Output

No response

Important Factoids

Consider this line in the SOA record:
allow_override = true

References

No response

Would you like to implement a fix?

None

@mjheitland mjheitland added the bug Addresses a defect in current functionality. label Jun 6, 2024
Copy link

github-actions bot commented Jun 6, 2024

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/route53 Issues and PRs that pertain to the route53 service. label Jun 6, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Jun 6, 2024
@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Jun 6, 2024
@ewbankkit
Copy link
Contributor

I think this will be addressed via #37850. Will investigate.

@ewbankkit ewbankkit self-assigned this Jun 6, 2024
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Jun 6, 2024
@ewbankkit
Copy link
Contributor

ewbankkit commented Jun 6, 2024

Verified that this is fixed by #37850 and will be available in Terraform AWS Provider v5.53.0, likely released later today.

v5.52.0

Do you really want to destroy all resources?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

aws_route53_record.public_hosted_zone_soa: Destroying... [id=Z09159933EE0YK3LTOO5W_comservice-99-9999999999.aws.lpsolutions.com_SOA]
╷
│ Error: deleting Route53 Record (Z09159933EE0YK3LTOO5W_comservice-99-9999999999.aws.lpsolutions.com_SOA): operation error Route 53: ChangeResourceRecordSets, https response error StatusCode: 400, RequestID: b7c3e67e-dd0f-4fc0-8560-5289668a962a, InvalidChangeBatch: [A HostedZone must contain exactly one SOA record.]
│ 
│ 
╵

v5.53.0

Do you really want to destroy all resources?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

aws_route53_record.public_hosted_zone_soa: Destroying... [id=Z09159933EE0YK3LTOO5W_comservice-99-9999999999.aws.lpsolutions.com_SOA]
aws_route53_record.public_hosted_zone_soa: Destruction complete after 0s
aws_route53_zone.public_hosted_zone: Destroying... [id=Z09159933EE0YK3LTOO5W]
aws_route53_zone.public_hosted_zone: Still destroying... [id=Z09159933EE0YK3LTOO5W, 10s elapsed]
aws_route53_zone.public_hosted_zone: Still destroying... [id=Z09159933EE0YK3LTOO5W, 20s elapsed]
aws_route53_zone.public_hosted_zone: Still destroying... [id=Z09159933EE0YK3LTOO5W, 30s elapsed]
aws_route53_zone.public_hosted_zone: Still destroying... [id=Z09159933EE0YK3LTOO5W, 40s elapsed]
aws_route53_zone.public_hosted_zone: Destruction complete after 46s

Destroy complete! Resources: 2 destroyed.

@ewbankkit ewbankkit added this to the v5.53.0 milestone Jun 6, 2024
Copy link

github-actions bot commented Jun 6, 2024

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

Copy link

github-actions bot commented Jun 7, 2024

This functionality has been released in v5.53.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Jun 7, 2024
Copy link

github-actions bot commented Jul 8, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/route53 Issues and PRs that pertain to the route53 service.
Projects
None yet
Development

No branches or pull requests

2 participants