FEATURES OPEN SOURCE ABOUT DOCS LOGIN REGISTER

aws_route53_zone

Provides a Route53 Hosted Zone resource.

Example Usage

resource "aws_route53_zone" "primary" {
   name = "example.com"
}

For use in subdomains, note that you need to create a aws_route53_record of type NS as well as the subdomain zone.

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

resource "aws_route53_zone" "dev" {
  name = "dev.example.com"

  tags {
    Environment = "dev"
  }
}

resource "aws_route53_record" "dev-ns" {
    zone_id = "${aws_route53_zone.main.zone_id}"
    name = "dev.example.com"
    type = "NS"
    ttl = "30"
    records = [
        "${aws_route53_zone.dev.name_servers.0}",
        "${aws_route53_zone.dev.name_servers.1}",
        "${aws_route53_zone.dev.name_servers.2}",
        "${aws_route53_zone.dev.name_servers.3}"
    ]
}

Argument Reference

The following arguments are supported:

Attributes Reference

The following attributes are exported:

Import

Route53 Zones can be imported using the zone id, e.g.

$ terraform import aws_route53_zone.myzone Z1D633PJN98FT9

See the source of this document at Terraform.io