Skip to content

Delegate subdomains in Route 53 to other hosted zones, including across accounts

License

Notifications You must be signed in to change notification settings

thoughtbot/terraform-route-53-delegated-subdomain

Repository files navigation

Route 53 Delegated Subdomain Terraform Module

Creates a Route 53 hosted zone for a subdomain delegated from another hosted zone. You can use this module to create restricted hosted zones for specific environments, or to allow another account to manage record sets for a specific subdomain.

Example

terraform {
  backend "s3" {}

  required_providers {
    aws       = {
      version = "~> 3.0"
    }
  }
}

provider "aws" {
  alias  = "network"
  region = "us-west-2"
}

provider "aws" {
  region = "us-west-2"
  alias  = "staging"
}

module "subdomain" {
  source = "[email protected]:thoughtbot/terraform-route-53-delegated-subdomain.git?ref=v0.3.0"

  providers = {
    aws.root      = aws.network
    aws.subdomain = aws.staging
  }

  root_domain_name = "example.com"
  subdomain        = "staging"
}

Requirements

Name Version
terraform >= 1.0.0
aws ~> 5.0

Providers

Name Version
aws.root ~> 5.0
aws.subdomain ~> 5.0

Modules

No modules.

Resources

Name Type
aws_route53_record.ns resource
aws_route53_zone.subdomain resource
aws_route53_zone.root data source

Inputs

Name Description Type Default Required
root_domain_name Domain name (ie example.com) for the root hosted zone string n/a yes
subdomain Subdomain (ie www) for which a hosted zone should be delegated string n/a yes
tags Tags which should be applied to created resources map(string) {} no
ttl TTL value for NS DNS records number 3600 no

Outputs

Name Description
name Full name of the subdomain
subdomain_zone_id Zone ID of the subdomain hosted zone

Contributing

Please see CONTRIBUTING.md.

License

This module is Copyright © 2021 Joe Ferris and thoughtbot. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About thoughtbot

thoughtbot

This repo is maintained and funded by thoughtbot, inc. The names and logos for thoughtbot are trademarks of thoughtbot, inc.

We love open source software! See our other projects. We are available for hire.

About

Delegate subdomains in Route 53 to other hosted zones, including across accounts

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published