ministryofjustice / modernisation-platform

A place for the core work of the Modernisation Platform • This repository is defined and managed in Terraform
https://user-guide.modernisation-platform.service.justice.gov.uk
MIT License
681 stars 289 forks source link

Add Route 53 code to example #3032

Closed davidkelliott closed 1 year ago

davidkelliott commented 1 year ago

User Story

As a Modernisation Platform Engineer I want to write an example of creating a Route53 entry through terraform So that customers have a working example they can relate to our documentation

Story #1679 should be completed before starting on this story

User Type(s)

Modernisation Platform Customer

Value

Here is what our users are trying to do: https://user-guide.modernisation-platform.service.justice.gov.uk/user-guide/how-to-configure-dns.html#dns-with-acm-certificate

We have an example of this being done partly through our example environment here

We should expand on this by creating a Route53 record that shows the creation of a record pointing at a public load balancer DNS address. Probably something like this:

resource "aws_route53_record" "example" {
  provider = aws.core-vpc

  zone_id = data.aws_route53_zone.external.zone_id
  name    = "${var.networking[0].application}.${var.networking[0].business-unit}-${local.environment}.modernisation-platform.service.justice.gov.uk"
  type    = "A"

  alias {
    name = aws_lb.example.dns_name
    zone_id = aws_lb.example.zone_id
    evaluate_target_health = true
  }
}

This should give our customers and end-to-end example of creating a certificate, validating it, attaching it to a resource, and creating a DNS record pointing at an AWS resource.

Questions / Assumptions / Hypothesis

Hypothesis

If we provide a simple working example Then we will make things easier for our customers to understand

Definition of done

Reference

How to write good user stories

dms1981 commented 1 year ago

https://github.com/ministryofjustice/modernisation-platform/issues/1679 is referenced here, but hopefully we have a sufficient answer through https://github.com/ministryofjustice/modernisation-platform-environments/blob/main/terraform/environments/example/certificates.tf