2014-07-23 21:47:21 +02:00
|
|
|
---
|
|
|
|
layout: "aws"
|
2014-07-23 21:56:28 +02:00
|
|
|
page_title: "AWS: aws_route53_zone"
|
2014-07-23 21:47:21 +02:00
|
|
|
sidebar_current: "docs-aws-resource-route53-zone"
|
2014-10-22 05:21:56 +02:00
|
|
|
description: |-
|
|
|
|
Provides a Route53 Hosted Zone resource.
|
2014-07-23 21:47:21 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
# aws\_route53\_zone
|
|
|
|
|
|
|
|
Provides a Route53 Hosted Zone resource.
|
|
|
|
|
|
|
|
## Example Usage
|
|
|
|
|
|
|
|
```
|
|
|
|
resource "aws_route53_zone" "primary" {
|
|
|
|
name = "example.com"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2015-02-26 23:20:30 +01:00
|
|
|
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"
|
2015-04-23 11:27:35 +02:00
|
|
|
|
|
|
|
tags {
|
|
|
|
Environment = "dev"
|
|
|
|
}
|
2015-02-26 23:20:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_route53_record" "dev-ns" {
|
|
|
|
zone_id = "${aws_route53_zone.main.zone_id}"
|
|
|
|
name = "dev.example.com"
|
|
|
|
type = "NS"
|
|
|
|
ttl = "30"
|
2015-04-14 21:18:38 +02:00
|
|
|
records = [
|
2015-04-23 11:27:35 +02:00
|
|
|
"${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}"
|
2015-04-14 21:18:38 +02:00
|
|
|
]
|
2015-02-26 23:20:30 +01:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2014-07-23 21:47:21 +02:00
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
|
|
|
* `name` - (Required) This is the name of the hosted zone.
|
2015-05-21 22:05:52 +02:00
|
|
|
* `comment` - (Optional) A comment for the hosted zone. Defaults to 'Managed by Terraform'.
|
2015-04-23 11:27:35 +02:00
|
|
|
* `tags` - (Optional) A mapping of tags to assign to the zone.
|
2015-04-13 19:42:20 +02:00
|
|
|
* `vpc_id` - (Optional) The VPC to associate with a private hosted zone. Specifying `vpc_id` will create a private hosted zone.
|
2016-06-17 13:35:49 +02:00
|
|
|
Conflicts w/ `delegation_set_id` as delegation sets can only be used for public zones.
|
2015-04-13 19:42:20 +02:00
|
|
|
* `vpc_region` - (Optional) The VPC's region. Defaults to the region of the AWS provider.
|
2015-05-17 18:54:51 +02:00
|
|
|
* `delegation_set_id` - (Optional) The ID of the reusable delgation set whose NS records you want to assign to the hosted zone.
|
2016-06-17 13:35:49 +02:00
|
|
|
Conflicts w/ `vpc_id` as delegation sets can only be used for public zones.
|
2014-07-23 21:47:21 +02:00
|
|
|
|
|
|
|
## Attributes Reference
|
|
|
|
|
|
|
|
The following attributes are exported:
|
|
|
|
|
|
|
|
* `zone_id` - The Hosted Zone ID. This can be referenced by zone records.
|
2015-05-17 18:54:51 +02:00
|
|
|
* `name_servers` - A list of name servers in associated (or default) delegation set.
|
2016-01-14 21:55:39 +01:00
|
|
|
Find more about delegation sets in [AWS docs](https://docs.aws.amazon.com/Route53/latest/APIReference/actions-on-reusable-delegation-sets.html).
|
2016-07-21 00:28:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
## Import
|
|
|
|
|
|
|
|
Route53 Zones can be imported using the `zone id`, e.g.
|
|
|
|
|
|
|
|
```
|
|
|
|
$ terraform import aws_route53_zone.myzone Z1D633PJN98FT9
|
|
|
|
```
|