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

Feature Request: Route53 Resolver Rule #6550

Closed
gazoakley opened this issue Nov 22, 2018 · 6 comments · Fixed by #7799
Closed

Feature Request: Route53 Resolver Rule #6550

gazoakley opened this issue Nov 22, 2018 · 6 comments · Fixed by #7799
Labels
new-resource Introduces a new resource. service/route53resolver Issues and PRs that pertain to the route53resolver service.
Milestone

Comments

@gazoakley
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

New or Affected Resource(s)

  • aws_route53_resolver_rule

Potential Terraform Configuration

resource "aws_route53_resolver_rule" "example" {
  name                 = "example"
  domain_name          = "example.com"
  resolver_endpoint_id = "..."
  rule_type            = "FORWARD"

  target_ip {
    ip   = "123.45.67.89"
    port = 1234
  }

  tags {
    Foo = "Barr"
  }
}

References

@gazoakley
Copy link
Contributor Author

I'm planning to work on this unless anyone else has already started (also mentioned in #6525)

@bflad bflad added new-resource Introduces a new resource. service/route53resolver Issues and PRs that pertain to the route53resolver service. labels Nov 25, 2018
@nywilken
Copy link
Contributor

The aws_route53_resolver_rule resource has been merged and will release with version 2.2.0 of the Terraform AWS Provider, likely later today.

@bflad bflad added this to the v2.2.0 milestone Mar 15, 2019
@bflad
Copy link
Contributor

bflad commented Mar 15, 2019

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

@egarbi
Copy link
Contributor

egarbi commented Apr 4, 2019

@gazoakley
I really don't understand why target_ip has been implemented as a block.
This leads to some limitations when you are trying to add different numbers of IPs in a module.
Example, suppose that I need 2 IPs on Testing environment but 4 in Prod. I will need to hack the module as below:

resource "aws_route53_resolver_rule" "double" {
  count                = "${length(split(",", lookup(var.forwarding_rules[0], "ips"))) == 2 ? length(var.forwarding_rules) : 0}"
  domain_name          = "${lookup(var.forwarding_rules[count.index], "domain_name")}"
  name                 = "${lookup(var.forwarding_rules[count.index], "name")}"
  rule_type            = "${lookup(var.forwarding_rules[count.index], "rule_type")}"
  resolver_endpoint_id = "${aws_route53_resolver_endpoint.outbound.id}"

  target_ip {
    ip = "${element(split(",", lookup(var.forwarding_rules[count.index], "ips")),0)}"
  }

  target_ip {
    ip = "${element(split(",", lookup(var.forwarding_rules[count.index], "ips")),1)}"
  }
}

resource "aws_route53_resolver_rule" "quad" {
  count                = "${length(split(",", lookup(var.forwarding_rules[0], "ips"))) == 4 ? length(var.forwarding_rules) : 0}"
  domain_name          = "${lookup(var.forwarding_rules[count.index], "domain_name")}"
  name                 = "${lookup(var.forwarding_rules[count.index], "name")}"
  rule_type            = "${lookup(var.forwarding_rules[count.index], "rule_type")}"
  resolver_endpoint_id = "${aws_route53_resolver_endpoint.outbound.id}"

  target_ip {
    ip = "${element(split(",", lookup(var.forwarding_rules[count.index], "ips")),0)}"
  }

  target_ip {
    ip = "${element(split(",", lookup(var.forwarding_rules[count.index], "ips")),1)}"
  }

  target_ip {
    ip = "${element(split(",", lookup(var.forwarding_rules[count.index], "ips")),2)}"
  }

  target_ip {
    ip = "${element(split(",", lookup(var.forwarding_rules[count.index], "ips")),3)}"
  }
}

so, if you need 2 ips, you pass ips value as a string of 2 element, and if you need 4 you pass 4 elements as string. Ugly.
Also if you look into Cloudformation templates, target_ips (and ports) are passed as a list and an extra port variable is not needed.
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53resolver-resolverrule.html#cfn-route53resolver-resolverrule-targetips
Why did you decide to implement this with ip and port variables into blocks?

@ASethi93
Copy link

cant we apply count on the target Ip's ? also this module creates the forwarding rule only what if one has to create a sys type

@ghost
Copy link

ghost commented Nov 13, 2019

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Nov 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-resource Introduces a new resource. service/route53resolver Issues and PRs that pertain to the route53resolver service.
Projects
None yet
5 participants