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: Add support for Alias records into AWS Route 53 #1775

Merged
merged 2 commits into from
May 4, 2015

Conversation

radeksimko
Copy link
Member

This closes #747
Documentation attached.

Alias records (as documented) can be currently used in conjunction with

Test plan

$ make testacc TEST=./builtin/providers/aws TESTARGS='-run=Route53Record' 2>/dev/null
go generate ./...
TF_ACC=1 go test ./builtin/providers/aws -v -run=Route53Record -timeout 45m
=== RUN TestAccRoute53Record
--- PASS: TestAccRoute53Record (260.16s)
=== RUN TestAccRoute53Record_txtSupport
--- PASS: TestAccRoute53Record_txtSupport (279.02s)
=== RUN TestAccRoute53Record_generatesSuffix
--- PASS: TestAccRoute53Record_generatesSuffix (269.83s)
=== RUN TestAccRoute53Record_wildcard
--- PASS: TestAccRoute53Record_wildcard (402.11s)
=== RUN TestAccRoute53Record_weighted
--- PASS: TestAccRoute53Record_weighted (266.97s)
=== RUN TestAccRoute53Record_alias
--- PASS: TestAccRoute53Record_alias (529.72s)
=== RUN TestAccRoute53Record_weighted_alias
--- PASS: TestAccRoute53Record_weighted_alias (521.43s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    2529.257s

Example

resource "aws_route53_zone" "main" {
  name = "notexample.com"
}

resource "aws_route53_record" "alias" {
  zone_id = "${aws_route53_zone.main.zone_id}"
  name = "www"
  type = "A"

  alias {
    zone_id = "${aws_elb.main.zone_id}"
    name = "${aws_elb.main.dns_name}"
    evaluate_target_health = true
  }
}

resource "aws_elb" "main" {
  name = "foobar-terraform-elb"
  availability_zones = ["us-west-2a"]

  listener {
    instance_port = 80
    instance_protocol = "http"
    lb_port = 80
    lb_protocol = "http"
  }
}

Related PR: #1366. I hope I covered all the edge cases and conflicts (e.g. TTL).

@mitchellh
Copy link
Contributor

Looks perfect!

mitchellh added a commit that referenced this pull request May 4, 2015
aws: Add support for Alias records into AWS Route 53
@mitchellh mitchellh merged commit 8633c88 into hashicorp:master May 4, 2015
@radeksimko radeksimko deleted the r53-alias-record branch May 4, 2015 21:08
@radeksimko
Copy link
Member Author

@c4milo I see your point, sorry for the troubles caused. I was actually thinking about this problem, but it's not just related to this resource, it's a global issue affecting many other resources as well.

There is simply nothing like RequiredWhen yet where we could say "this is only required if property X == Y" or "one of these fields is required". I agree that the Schema desperately needs such functionality. I may have a look into it this weekend.

also, this change is currently misaligned with what the documentation says.

could you be a bit more specific, please?

@c4milo
Copy link
Contributor

c4milo commented May 27, 2015

@radeksimko I didn't mean it in a negative way, I should've used a different word instead of "waste". It just took me longer than normal to realize what was going on. So, there is nothing to be sorry about :)

Regarding the documentation, I think it only needs to make more explicit that ttl and records attributes are required only if there is not an ALIAS block present.

@radeksimko
Copy link
Member Author

@c4milo Regarding docs -> see #2092

I was already adding ConflictsWith for similar purpose, so I'd expect it should tell you that these parameters conflict with each other. If it doesn't, then there must be a bug in that implementation.

@c4milo
Copy link
Contributor

c4milo commented May 27, 2015

@radeksimko, yes, I tested that case and it complains about conflicting configuration options correctly.

@ghost
Copy link

ghost commented May 2, 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 May 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AWS Route 53 ALIAS A record support
4 participants