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

AWS Route53 record fails to apply when instance is stopped / shutdown #173

Closed
hashibot opened this issue Jun 13, 2017 · 5 comments
Closed
Labels
bug Addresses a defect in current functionality. service/route53 Issues and PRs that pertain to the route53 service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.

Comments

@hashibot
Copy link

This issue was originally opened by @bmalynovytch as hashicorp/terraform#6770. It was migrated here as part of the provider split. The original body of the issue is below.


Dear all,

I'm facing a recurrent issue.
When applying configuration with some AWS instances that are shutdown / stopped, with Route53 records attached, Terraform tries to apply a new (empty) value to the aws_route53_record which fails:

~ aws_route53_record.myhost
    records.0:         "" => ""
    records.200629859: "1.2.3.4" => ""
* aws_route53_record.myhost: InvalidChangeBatch: Invalid Resource Record: FATAL problem: ARRDATAIllegalIPv4Address (Value is not a valid IPv4 address) encountered with ''
    status code: 400, request id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx

Terraform Version

$ terraform -v
Terraform v0.6.16

Affected Resource(s)

  • aws_route53_record

Expected Behavior

Do not apply a new value if it does not match the validation pattern.

Actual Behavior

Request fails, trying to apply an invalid (empty) value.

Steps to Reproduce

  1. define a resource of type aws_instance
  2. define a resource of type aws_route53_record of type A, using the previously created instance's gathered IP address (aws_instance.myhost.public_ip)
  3. terraform apply
  4. Instance is created, DNS record is created with the corresponding IP address
  5. Stop the instance using AWS Console
  6. terraform apply
  7. Apply fails, trying to change/update the attached IP address

References

This issue is related to comment hashicorp/terraform#1579 (comment)

@hashibot hashibot added the bug Addresses a defect in current functionality. label Jun 13, 2017
@bflad bflad added the service/route53 Issues and PRs that pertain to the route53 service. label Jan 23, 2018
@ezyang
Copy link

ezyang commented Apr 5, 2018

Also affected by this issue. We wouldn't mind if it goes to something bogus IP in this case. Is there any good workaround for this?

@andrew-j-price
Copy link

Hopefully you found an answer by now @ezyang but my workaround is to use coalesce to set a dummy value.

resource "aws_route53_record" "microk8s_record" {
  count   = "${var.enable_microk8s}"
  zone_id = "${var.aws_route53_zone_id}"
  name    = "micro.example.com"
  type    = "A"
  ttl     = "150"
  records = ["${coalesce(aws_instance.microk8s_aio.public_ip, var.dummy_ip)}"]
}

@ezyang
Copy link

ezyang commented May 29, 2019 via email

@github-actions
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Jan 11, 2022
@github-actions
Copy link

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 May 14, 2022
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. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Projects
None yet
Development

No branches or pull requests

4 participants