Skip to content

DNS

All applications in a environment will be deployed to a subdomain of oslo.systems.

The default domain for your environment is {Environment}.oslo.systems. Each new application will use a subdomain of this domain.

Step 1: Add and configure the dns package

repo-iac/environments/dev/
ok pkg add dns
cd dns

Step 2: Install and apply the package

dns/
ok pkg install
terraform init
terraform apply

Once terraform apply completes, name servers will be printed to the console.

Output from terraform apply
name_servers = tolist([
  "ns-123.awsdns-44.org",
  "ns-321.awsdns-29.co.uk",
  "ns-213.awsdns-35.com",
  "ns-231.awsdns-18.net",
])

Step 3: Verify

aws route53 list-hosted-zones | jq '.HostedZones[].Name'

Output should contain the domain you created.

Login to AWS console and navigate to Route 53. Select Hosted zones.

List should contain the domain you created.


Step 4: Add DNS Name Servers

The output from Step 2 are the name servers for the root domain specified in _gp_dns.tf. Because oslo.systems was specified as the root domain, follow the guide Adding a subdomain to oslo.systems to complete the setup.

To override default configuration, set the root_domain variable in dns/config_override.tf.

The domain pirates-dev.oslo.systems should now resolve to applications you deploy.

Step 5: Verify

To verify the subdomain is properly registered with a name server (after completing step 4):

dig NS +short {Environment}.oslo.systems

This should return name servers corresponding to the list printed after terraform apply in step 2.

If you don't have dig installed, use this DNS lookup tool to check {your-subdomain}.oslo.systems.

Step 6: Add DNS for oslo.kommune.no (optional)

All solutions visible to residents of Oslo and Oslo municipality employees should always use oslo.kommune.no. If you require oslo.kommune.no as subdomain, you need to follow these steps.

Step 6a: Create a Route53 zone for subdomain

repo-iac/environments/prod/dns/config.tf
locals {
    my_product_root_domain = "my-product-root-domain.oslo.kommune.no"
}
repo-iac/environments/prod/dns/dns-oslo-kommune-no.tf
resource "aws_route53_zone" "my_product_root_domain" {
  name = local.my_product_root_domain
}

output "name_servers" {
  value       = aws_route53_zone.my_product_root_domain.name_servers
  description = "A list of name servers in associated delegation set. The root domain zone needs these name servers as NS records for your domain."
}

Step 6b: Request DNS changes on oslo.kommune.no

Use the output from 6a to request a DNS change:

  • Go to the #origo-kjøremiljø-support channel on Slack
  • Paste the value from the output in step 6a together with the URL for your IaC repository
  • Team Kjøremiljø is going to request the DNS change on your behalf

Step 6c: Verify

After team Kjøremiljø completes the DNS change, you are contacted on Slack. Then, verify the new subdomain with:

dig NS +short my-product-root-domain.oslo.kommune.no

Any update or change that results in an updated name_servers output requires submitting a new DNS change request to team Kjøremiljø.

Next step

Set up networking.