4

I've got an Amazon VPC with a bastion and service discovery router (Consul) that I'm using to route traffic from my company's intranet to the VPC.

Now I'm running jobs in the VPC (Webdriver) that need to look up newly registered services from a docker swarm host.

From the VPC I want to point to the service discovery server.

I want to create this dns wildcard entry using Terraform.

This is my first go at it - but I feel like something is missing:

resource "aws_route53_record" "*" {
   zone_id = "${myzone.primary.zone_id}"
   name = "*.cloud.companyintranet.com"
   type = "A"
   ttl = "300"
   records = ["${aws_eip.lb.public_ip}"]
}

My question is: How to use Terraform to create a wildcard dns record in an Amazon VPC to point to a service discovery server?

hawkeye
  • 34,745
  • 30
  • 150
  • 304
  • What's wrong with that? Does it not work? I'm unsure about using `*` as the resource usage name as I'd imagine that might cause some issue with Terraform's splats for things created in a loop and also the name `wildcard` seems more self explanatory anyway. – ydaetskcoR May 14 '16 at 20:02
  • The resource part `resource "aws_route53_record" "*" ` is wrong, you can't use `*` as resource name in `terraform` – BMW May 16 '16 at 01:21

1 Answers1

4

* should absolutely work for wildcards, however only in the NAME field:

resource "aws_route53_record" "wildcard_cloud_companyintranet_com" {
   zone_id = "${myzone.primary.zone_id}"
   name = "*.cloud.companyintranet.com"
   type = "A"
   ttl = "300"
   records = ["${aws_eip.lb.public_ip}"]
}

Just make sure you use descriptive names in the resource field, instead of the *

AsciiFace
  • 91
  • 8