Skip to content

Better failover CNAME DNS records

Compare
Choose a tag to compare
@forevermatt forevermatt released this 04 Aug 19:56
· 24 commits to develop since this release
c37551e

Added

  • Add intermediate CNAMEs
    • Example of new DNS records:
      • "Public" CNAME: api.example.com -->
        • api-us-east-1.example.com (for primary region)
        • api-us-west-w.example.com (for secondary region)
      • "Intermediate" CNAME (primary): api-us-east-1.example.com --> d-abcde12345.execute-api.us-east-1.amazonaws.com
      • "Intermediate" CNAME (secondary): api-us-west-2.example.com --> d-zyxwv67890.execute-api.us-west-2.amazonaws.com
  • Add outputs:
    • primary_region_domain_name - The domain name to use (as the value of the "public" CNAME record) to use the primary region. Example: api-us-east-1.example.com
    • secondary_region_domain_name - The domain name to use (as the value of the "public" CNAME record) to use the secondary region. Example: api-us-west-2.example.com

Changed (non-breaking)

  • Rename some internal modules to better align with their purpose:
    • fail-over-cname --> fail-over-cnames
    • custom_domains --> api_gateway_domains_and_certs
  • Rename some other resources to differentiate between public (main) CNAME, intermediate CNAME, and AWS API Gateway domain names.

Fixed

  • Wait for certificate to be issued before trying to use it

Note: If desired, you can use terraform state mv to reduce the amount of deletion-and-recreation that the module-renames and resource-renames will cause (if that matters to you).

Example (assuming your use of this module is named "dns_for_failover"):

terraform state mv module.dns_for_failover.module.fail_over_cname module.dns_for_failover.module.fail_over_cnames
terraform state mv module.dns_for_failover.module.custom_domains module.dns_for_failover.module.api_gateway_domains_and_certs