From 35cd59b0fe6cc37ae64eb4437a6f16e0239870c7 Mon Sep 17 00:00:00 2001 From: Aidan Feldman Date: Mon, 9 Mar 2020 02:59:30 -0400 Subject: [PATCH 1/5] use module to handle redirects for 18F Jobs --- terraform/18f.gov.tf | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/terraform/18f.gov.tf b/terraform/18f.gov.tf index a5cd261f..879d9ac8 100644 --- a/terraform/18f.gov.tf +++ b/terraform/18f.gov.tf @@ -645,20 +645,15 @@ resource "aws_route53_record" "18f_gov_innovation-toolkit-prototype_18f_gov_a" { } } -resource "aws_route53_record" "18f_gov_jobs_18f_gov_cname" { - zone_id = "${aws_route53_zone.18f_gov_zone.zone_id}" - name = "jobs.18f.gov." - type = "CNAME" - ttl = 300 - records = ["d2o3l1lqmcr15h.cloudfront.net."] -} +module "18f_gov__join_18f_gov_redirect" { + source = "mediapop/redirect/aws" + version = "~> 1.2.0" -resource "aws_route53_record" "18f_gov_join_18f_gov_cname" { - zone_id = "${aws_route53_zone.18f_gov_zone.zone_id}" - name = "join.18f.gov." - type = "CNAME" - ttl = 300 - records = ["dpjnqahvua4qy.cloudfront.net"] + domains = { + "18f.gov." = ["jobs.18f.gov", "join.18f.gov"] + } + + redirect_to = "https://18f.gsa.gov/join/" } resource "aws_route53_record" "18f_gov_lean-product-design_18f_gov_a" { From c8466d17800549af748b3898a90e48754f3e8247 Mon Sep 17 00:00:00 2001 From: Aidan Feldman Date: Mon, 23 Mar 2020 12:57:56 -0400 Subject: [PATCH 2/5] format README using Prettier --- README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index b8e7e891..309a2550 100644 --- a/README.md +++ b/README.md @@ -12,21 +12,21 @@ This repository holds the source code for configuring DNS for domains managed by Assuming you're TTS staff, it's recommended that you **make the change in a branch on this repository itself, rather than on a fork**, because the credentials aren't shared with forks. (The `master` branch is [protected](https://help.github.com/articles/about-protected-branches/) to limit write access only to certain staff, and to ensure history doesn't get overwritten, etc.) For major changes, it is recommended to keep the TTL value low just before and during the change period in order to make it easier to verify the changes went through as expected. 1. Is the domain pointing to the right nameservers? In other words, is there a file for the domain under [`terraform/`](terraform) already? - * **Yes:** Continue to next step. - * **No:** - 1. Add a file for the domain (or subdomain, if the second-level domain isn't being added), to create the [public hosted zone](http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingHostedZone.html). - * [`18f.us`](terraform/18f.us.tf) is a good example to copy from. - * You'll be using Terraform's [`aws_route53_zone`](https://www.terraform.io/docs/providers/aws/d/route53_zone.html). - 1. After the pull request is merged, to get the name servers for your domain check the output for your build in [CircleCI](https://circleci.com/gh/18F/dns). If you need further assistance, check with [#admins-dns](https://gsa-tts.slack.com/messages/C4L58EQ5T). - 1. Change the nameservers for the domain to point to AWS. - * For `.gov` domains, this will be done by the "domain manager" in [dotgov.gov](https://www.dotgov.gov/). The domain manager is likely someone in the respective agency's IT department. + - **Yes:** Continue to next step. + - **No:** + 1. Add a file for the domain (or subdomain, if the second-level domain isn't being added), to create the [public hosted zone](http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingHostedZone.html). + - [`18f.us`](terraform/18f.us.tf) is a good example to copy from. + - You'll be using Terraform's [`aws_route53_zone`](https://www.terraform.io/docs/providers/aws/d/route53_zone.html). + 1. After the pull request is merged, to get the name servers for your domain check the output for your build in [CircleCI](https://circleci.com/gh/18F/dns). If you need further assistance, check with [#admins-dns](https://gsa-tts.slack.com/messages/C4L58EQ5T). + 1. Change the nameservers for the domain to point to AWS. + - For `.gov` domains, this will be done by the "domain manager" in [dotgov.gov](https://www.dotgov.gov/). The domain manager is likely someone in the respective agency's IT department. 1. Add the relevant additional [record sets](http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/rrsets-working-with.html). In Terraform, these are known as [`aws_route53_record`](https://www.terraform.io/docs/providers/aws/r/route53_record.html)s. Generally speaking, the required arguments are: - * `zone_id` - * `name` - * `type` - * Either `alias` or `records` - * If `alias`, then `evaluate_target_health` is also required and `ttl` is not allowed. - * If `records`, then `ttl` is also required and `evaluate_target_health` is not allowed. + - `zone_id` + - `name` + - `type` + - Either `alias` or `records` + - If `alias`, then `evaluate_target_health` is also required and `ttl` is not allowed. + - If `records`, then `ttl` is also required and `evaluate_target_health` is not allowed. It's worth noting that if you are pointing to a CloudFront distro, you should use Route 53's own `alias` and not a CNAME record. In fact, CNAMEing a top-level domain (or the top level of a delegated subdomain) is not allowed in DNS. See the various examples in the repo, such as [this one](https://github.com/18F/dns/blob/deploy/terraform/usa.gov.tf#L8-L17). From b529174ccb2af5cfcb204ebf9aad5a115eddae77 Mon Sep 17 00:00:00 2001 From: Aidan Feldman Date: Mon, 23 Mar 2020 13:44:10 -0400 Subject: [PATCH 3/5] lock redirect module version --- .tool-versions | 1 + terraform/18f.gov.tf | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .tool-versions diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 00000000..eaf9b092 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +terraform 0.11.14 diff --git a/terraform/18f.gov.tf b/terraform/18f.gov.tf index 879d9ac8..b4d6275b 100644 --- a/terraform/18f.gov.tf +++ b/terraform/18f.gov.tf @@ -647,7 +647,7 @@ resource "aws_route53_record" "18f_gov_innovation-toolkit-prototype_18f_gov_a" { module "18f_gov__join_18f_gov_redirect" { source = "mediapop/redirect/aws" - version = "~> 1.2.0" + version = "1.2.0" domains = { "18f.gov." = ["jobs.18f.gov", "join.18f.gov"] From 1765a1ed108aa9e4c9ff65c010fbef706da7e060 Mon Sep 17 00:00:00 2001 From: Aidan Feldman Date: Mon, 23 Mar 2020 13:46:55 -0400 Subject: [PATCH 4/5] add documentation about redirects --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 309a2550..c8b1eb28 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,10 @@ On merge, changes are deployed to an AWS account hosting the Route53 records aut **Please note: only production systems with an ATO that are [categorized](https://before-you-ship.18f.gov/ato/levels/) as Low impact should have their DNS configuration here. If you wish to create DNS records for pre-production systems, please use the domain `sandbox.gov` which is available in the [TTS Sandbox account](https://before-you-ship.18f.gov/infrastructure/sandbox/).** +### Redirects + +We are [moving](https://github.com/18F/pages-redirects/issues/149) from [pages-redirects](https://github.com/18F/pages-redirects#domain-redirects) to fully configuring them in this repository. See the [`18f_gov__join_18f_gov_redirect`](terraform/18f.gov.tf) example. + ## Public domain This project is in the worldwide [public domain](LICENSE.md). As stated in the [license](LICENSE.md): From 0cdcd709f945c5c84b17e51e0adf0f74482804d7 Mon Sep 17 00:00:00 2001 From: Aidan Feldman Date: Mon, 23 Mar 2020 16:24:13 -0400 Subject: [PATCH 5/5] use search for linking to the redirect example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c8b1eb28..595525c3 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ On merge, changes are deployed to an AWS account hosting the Route53 records aut ### Redirects -We are [moving](https://github.com/18F/pages-redirects/issues/149) from [pages-redirects](https://github.com/18F/pages-redirects#domain-redirects) to fully configuring them in this repository. See the [`18f_gov__join_18f_gov_redirect`](terraform/18f.gov.tf) example. +We are [moving](https://github.com/18F/pages-redirects/issues/149) from [pages-redirects](https://github.com/18F/pages-redirects#domain-redirects) to fully configuring them in this repository. See the [`18f_gov__join_18f_gov_redirect`](https://github.com/18F/dns/search?q=18f_gov__join_18f_gov_redirect) example. ## Public domain