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

Can't setup Route53 Failover DNS records - InvalidInput: Invalid Request #3985

Closed
ninjaMog opened this issue Nov 19, 2015 · 7 comments
Closed

Comments

@ninjaMog
Copy link

Having trouble setting up failover DNS records via terraform, if I drop the health_check_id and failover fields, it all works fine.

I can setup the required DNS record manually with the same values. In fact if I do, when I run a plan terraform recognises it exists and says there's no changes to make.

Unfortunately no useful output from terraform, either when running dist version (Terraform v0.6.6), or a dev compiled version with debug!

dns.tf:

resource "aws_route53_record" "www" {
   zone_id = "ZNO4H1L7085BF"
   name = "test"
   health_check_id = "0e1a2063-19f4-4f27-8a39-10d8664515f7"
   failover = "PRIMARY"
   type = "CNAME"
   ttl = "60"
   set_identifier = "1"
   records = ["project-main-r6ubntg45w.elasticbeanstalk.com"]
}

Output from plan:

+ aws_route53_record.www
    failover:           "" => "PRIMARY"
    fqdn:               "" => "<computed>"
    health_check_id:    "" => "0e1a2063-19f4-4f27-8a39-10d8664515f7"
    name:               "" => "test"
    records.#:          "" => "1"
    records.2776629804: "" => "project-main-r6ubntg45w.elasticbeanstalk.com"
    set_identifier:     "" => "1"
    ttl:                "" => "60"
    type:               "" => "CNAME"
    zone_id:            "" => "ZNO4H1L7085BF"


Plan: 1 to add, 0 to change, 0 to destroy.

terraform apply

aws_route53_record.www: Creating...
  failover:           "" => "PRIMARY"
  fqdn:               "" => "<computed>"
  health_check_id:    "" => "0e1a2063-19f4-4f27-8a39-10d8664515f7"
  name:               "" => "test"
  records.#:          "" => "1"
  records.2776629804: "" => "project-main-r6ubntg45w.elasticbeanstalk.com"
  set_identifier:     "" => "1"
  ttl:                "" => "60"
  type:               "" => "CNAME"
  zone_id:            "" => "ZNO4H1L7085BF"
Error applying plan:

1 error(s) occurred:

* aws_route53_record.www: InvalidInput: Invalid request
    status code: 400, request id: <requestid>
@ninjaMog
Copy link
Author

Issue seems to be resolved in

Terraform v0.6.7-dev (0cbf79d+CHANGES)

(compiled from branch :- f-aws-elastic-beanstalk)

@teewhey
Copy link

teewhey commented Jan 18, 2016

I'm using version 0.6.9. I'm hitting this error when trying to destroy these resources.

@IanGordonOne
Copy link

Using terraform_0.6.11_windows_amd64.

main.tf:

resource "aws_route53_health_check" "green-mba" {
  fqdn = "montereybayaquarium.org"
  port = "80"
  type = "HTTP"
  resource_path = "/"
  failure_threshold = "3"
  request_interval = "30"

  tags = {
    Name = "MBA CMS health check"
  }
}

resource "aws_route53_record" "green-mba" {
  zone_id = "Z245YJSJRAN83I"
  name = "green-${var.environment}.${var.platform}.montereybayaquarium.org"
  type = "A"
  failover = "PRIMARY"
  health_check_id = "${aws_route53_health_check.green-mba.id}"

  alias {
    name = "${aws_elb.green-mba.dns_name}"
    zone_id = "${aws_elb.green-mba.zone_id}"
    evaluate_target_health = true
  }
}

resource "aws_route53_record" "green-mba-failover" {
  zone_id = "Z245YJSJRAN83I"
  name = "green-${var.environment}.${var.platform}.montereybayaquarium.org"
  type = "A"
  ttl = "300"
  records = ["${var.ip_of_failover_service}"]
  failover="SECONDARY"
}

Plan:

+ aws_route53_record.green-mba
    alias.#:                                 "" => "1"
    alias.1741685063.evaluate_target_health: "" => "1"
    alias.1741685063.name:                   "" => "green-production-cms-mba-979165135.us-west-1.elb.amazonaws.com"
    alias.1741685063.zone_id:                "" => "Z1M58G0W56PQJA"
    failover:                                "" => "PRIMARY"
    fqdn:                                    "" => "<computed>"
    health_check_id:                         "" => "072cab47-e03a-4e20-b2aa-187c0325a380"
    name:                                    "" => "green-production.cms.montereybayaquarium.org"
    type:                                    "" => "A"
    weight:                                  "" => "-1"
    zone_id:                                 "" => "Z245YJSJRAN83I"

+ aws_route53_record.green-mba-failover
    failover:          "" => "SECONDARY"
    fqdn:              "" => "<computed>"
    name:              "" => "green-production.cms.montereybayaquarium.org"
    records.#:         "" => "1"
    records.182719784: "" => "168.62.29.203"
    ttl:               "" => "300"
    type:              "" => "A"
    weight:            "" => "-1"
    zone_id:           "" => "Z245YJSJRAN83I"

Apply:

* aws_route53_record.green-mba-failover: InvalidInput: Invalid request
        status code: 400, request id: 88b608cc-d5c6-11e5-9a4c-8bab79036e13

@rajinders
Copy link

I am also trying to configure failover and running into the same issue described above by gordonlanJ
I am on terraform_0.6.12_windows_amd64

@rajinders
Copy link

It turns out that if I set the value of property set_identifier my route53 failover records are created.
Terraform documentation mentioned that this property is only required for weighted records so I was not setting it. When I was manually configuring the route53 recordset for failover I noticed that portal was automatically setting the value off ID. I tried doing the same and was pleased to see that record was successfully created.

@catsby
Copy link
Contributor

catsby commented Mar 11, 2016

Hello all –

I apologize for the trouble and silence here.

The crux of most of theses problems falls into to parts:

  • the need for set_identifier is not properly documented for using failover records
  • errors in deleting/modifying Route 53 Records from Terraform version 0.6.9 and earlier on newer versions

I've opened a pull request to address the documentation here:

For issues with deleting the weighted records, that was fixed in #4892 , upgrading to the latest version of Terraform should address this.

Sorry again for the trouble! Let us know if you need anything else.

@catsby catsby closed this as completed Mar 11, 2016
omeid pushed a commit to omeid/terraform that referenced this issue Mar 30, 2018
Fix the example bucket policy for detailed billing
@ghost
Copy link

ghost commented Apr 27, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants