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

Add LB zone_id output for aviatrix_gateway #552

Open
Merlz opened this issue Sep 2, 2020 · 1 comment
Open

Add LB zone_id output for aviatrix_gateway #552

Merlz opened this issue Sep 2, 2020 · 1 comment

Comments

@Merlz
Copy link

Merlz commented Sep 2, 2020

If you want to add a Route53 Alias entry for the LB (optionally) created by aviatrix_gateway module, then the load balancer zone_id needs to be used in the Route53 Alias record zone_id

Example:

resource "aws_route53_record" "www" {
  zone_id = var.route53_zone_id
  name    = "vpn.example.com"
  type    = "A"

  alias {
    name                   = aviatrix_gateway.avx_vpn_gw.elb_dns_name
    zone_id                = aviatrix_gateway.avx_vpn_gw.elb_zone_id ????
    evaluate_target_health = true
  }
}

A temporary workaround is to use something like this:

data "aws_lb" "vpn_gw_lb" {
  count = var.enable_elb ? 1 : 0
  name = var.elb_name

  depends_on = [aviatrix_gateway.avx_vpn_gw]
}

resource "aws_route53_record" "avx_vpn_gw_lb" {
  count = var.create_gateways && var.enable_elb && var.dns_zone_id != null && var.dns_zone_name != null ? 1 : 0

  name    = "vpn.${var.dns_zone_name}"
  zone_id = var.dns_zone_id
  type    = "A"

  alias {
    name                   = aviatrix_gateway.avx_vpn_gw[0].elb_dns_name
    zone_id                = data.aws_lb.vpn_gw_lb[0].zone_id
    evaluate_target_health = true
  }

  depends_on = [aviatrix_gateway.avx_vpn_gw]
}

Then use this datasource in the alias->zone_id, but it would be better to have the LB zone_id output since using a datasource creates a perpetual TF plan/apply change on each run.

@CyrusJavan
Copy link
Contributor

Hi @Merlz,
Thanks for bringing up this feature request! I have created a ticket in our internal issue tracker and we will aim to get this feature added in a future release. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants