Skip to content

Files

Latest commit

557ba39 · May 23, 2025

History

History
115 lines (83 loc) · 3.41 KB
·

File metadata and controls

115 lines (83 loc) · 3.41 KB
·

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 = "git@github.com: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.