dns

Adds dns to your environment

This module creates a GCP managed 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:
  google:
    region: us-central1
    project: XXX
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:
  google:
    region: us-central1
    project: XXX
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:
  google:
    region: us-central1
    project: XXX
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 The Set to true once the extra dns setup is complete and it will add the ssl certs. False False
subdomains A list of subdomains to also get ssl certs for. [] False

Outputs

Name Description
zone_id The ID of the hosted zone created
zone_name The name of the hosted zone created
name_servers The name servers of your hosted zone (very important for the dns setup)
domain The domain again
delegated Passing the delegated field forward
cert_self_link Self link to the certificate if delegated

Last modified August 5, 2022 : Cleanup install script (#197) (2175394)