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]: aws_route53_record fails when ttl is set to 0 #36411

Open
danielmotaleite opened this issue Mar 15, 2024 · 4 comments
Open

[Bug]: aws_route53_record fails when ttl is set to 0 #36411

danielmotaleite opened this issue Mar 15, 2024 · 4 comments
Labels
bug Addresses a defect in current functionality. service/route53 Issues and PRs that pertain to the route53 service.

Comments

@danielmotaleite
Copy link

danielmotaleite commented Mar 15, 2024

Terraform Core Version

v1.4.6

AWS Provider Version

v5.40.0

Affected Resource(s)

aws_route53_record

Expected Behavior

When ttl = 0 (zero), the resource should be created, just in line as the AWS route53 console

Actual Behavior

Error, no resource created, while the plan show OK
Can't recreate via terraform a record created manually in the AWS console

Relevant Error/Panic Output Snippet

Error: creating Route 53 Record: InvalidInput: Invalid request: Expected exactly one of [AliasTarget, all of [TTL, and ResourceRecords], or TrafficPolicyInstanceId], but found none in Change with [Action=UPSERT, Name=replica-1.example.com, Type=CNAME, SetIdentifier=replica-1]

Terraform Configuration Files

  resource "aws_route53_record" "this" {
       allow_overwrite = true
       name            = "replica-1.example.com"
       records         = [
           "staging-1.zzzzzzz.rds.amazonaws.com",
        ]
       set_identifier  = "replica-1"
       ttl             = 0
       type            = "CNAME"
       zone_id         = "XXXX"
    }

Steps to Reproduce

Create the tf to create a route53 record, with TTL = 0
try to apply the terraform
it should fail.
change the TTL> 0
apply the terraform
it should work now

Debug Output

No response

Panic Output

No response

Important Factoids

The AWS console didn't allow TTL in the past, but now it do allows and TTL= 0 is usefull for internal zones, as a weak load balancer, namely for RDS replica with healthchecks (route53_healthchecks), to add or remove replicas based on several checks. For that, we do not want cached results, as that may negate the healtcheck objective

References

No response

Would you like to implement a fix?

No

@danielmotaleite danielmotaleite added the bug Addresses a defect in current functionality. label Mar 15, 2024
Copy link

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 Mar 15, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 15, 2024
@justinretzolk justinretzolk changed the title [Bug]: [Bug]: aws_route53_record fails when ttl is set to 0 Mar 20, 2024
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Mar 20, 2024
@hugo-barros
Copy link

I went to tackle this one (as I was looking for a simple issue to be my first contribution), but my acceptance test didn't pass (with same error). I wonder whether it is possible to achieve this without the plugin framework? (Instead of sdkv2).

@danielmotaleite
Copy link
Author

@hugo-barros thank you for your effort
@justinretzolk any change of helping hugo in this problem

@danielmotaleite
Copy link
Author

just to add that this makes usage of weighted DNS extremely annoying, as it force me to manual change the ttl from zero to 1 to add any new entry, and them manually reset them back to zero

│ Error: creating Route 53 Record: InvalidChangeBatch: [RRSet with DNS name readreplica-amc.staging.internal., type CNAME, SetIdentifier readreplica-amc-4 cannot be created as weighted sets must contain the same TTL., RRSet with DNS name readreplica-amc.staging.internal., type CNAME, SetIdentifier readreplica-amc-4 cannot be created as weighted sets must contain the same TTL.]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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

3 participants