dns

Adds dns to your environment

This module creates a Route53 hosted zone for your given domain. The k8s-base module automatically hooks up the load balancer to it for the domain and subdomain specified, but in order for this to actually receive traffic you will need to complete the dns setup.

Changing dns domains

Currently, Opta does not support multiple domains (except subdomains) per environment, although that may change based on user demand. In order for a user to change the domain tied to their environment, they would need to remove their current dns module, and then add a new one after applying.

Take for example, if we had the current running environment:

name: staging
org_name: mycompany
providers:
  aws:
    region: us-east-1
    account_id: XXXXXXXXXXXX
modules:
  - type: base
  - type: dns
    domain: mycompany.dev
  - type: k8s-cluster
  - type: k8s-base

Supposed we wished to change the domain to “otherdomain.dev”. First we would remove the dns module:

name: staging
org_name: mycompany
providers:
  aws:
    region: us-east-1
    account_id: XXXXXXXXXXXX
modules:
  - type: base
  - type: k8s-cluster
  - type: k8s-base

Next we would opta apply the new yaml and see that the dns resources have been destroyed. Note that your site will be temporarily offline after this step and before the next steps are completed. Afterwards we would add the new dns module entry with the new domain like so:

name: staging
org_name: mycompany
providers:
  aws:
    region: us-east-1
    account_id: XXXXXXXXXXXX
modules:
  - type: base
  - type: dns
    domain: otherdomain.dev
  - type: k8s-cluster
  - type: k8s-base

We would opta apply like before and we would now have the new domain. Depending on your set up there may be some additional steps required:

What if I had the domain delegated already?

That’s fine, the removal of the old domain can proceed with no changes but at the end you would need to do the delegation steps for the new domain.

What if I had deployed some services whose public_uri was based off {parent.domain}?

You would need to do a new apply for each of those services as they would not have gotten the memo of the new domain. You can use the same image, and opta yaml for the service as before– zero change necessary, all we need is the new apply.

Fields

Name Description Default Required
domain The domain you want (you will also get the subdomains for your use) None True
delegated Set to true once the extra dns setup is complete and it will add the ssl certs. False False
upload_cert Deprecated False False
linked_module The module type (or name if given) to automatically add root dns records for. `` False

Outputs

Name Description
zone_id The ID of the hosted zone created
name_servers The name servers of your hosted zone (very important for the dns setup)
domain The domain again
cert_arn The arn of the ACM certificate which is used for ssl.

Last modified May 23, 2022 : Docs for new release (#191) (ba6432d)