Multi-Cloud DNS delegated Sub domain with Terraform Cloud
Overview
DNS in a multi-cloud world
As companies transition to multi-cloud deployments, creating a common way to deploy solutions has become a requirement, this is also easily achieved by using Terraform to create your immutable infrastructure.
The challenge you face is that the infrastructure in a cloud deployment is dynamic in nature and so you can't predict what the IP addresses of parts of your systems will be and these IP addresses can change daily if your developers have a fast deployment cycle.
The most common way for us to solve this problem is to create DNS records for each piece of the infrastructure that we are deploying and that needs to be addressed. If you deploy resources with external IP addresses on cloud providers they have different ways that these IP addresses are presented. Each cloud provider provides their solutions with differing features.
By providing and configuring your own DNS delegated zones within the providers you give yourself the flexibility you need when creating your applications within these clouds.
Overview
This post explains how you would utilise Terraform to deploy and manage a multi-cloud DNS solution from a hosted Route53 domain.
Prerequisites
For this example you need to have an account on each of the cloud providers if you only want to use two providers then you only need an account on the two you would like to use.
Terraform 0.12.x cli installed AWS Account GCP Account Azure Account Azure Service Principal Account Terraform Cloud account. DNS domain hosted on route53 Git repository hosted on Github or Gitlab or Bitbucket Text editor (I use vscode)
Steps
- Create a Terraform Cloud Free Account by following the guide you can find here https://www.terraform.io/docs/cloud/getting-started/access.html
- Login to your Terraform Cloud Account.
- Create an organization, I will use dns-multicloud-org.
- Create a new workspace for the dns deployment. I will call mine dns-multicloud.
You now need to configure some variables.
General Variables
created-by: terraform (This a variable You use in your tags to show it was created by Terraform).
owner: dns-demo-team (This is another label so that you know who the owner is).
namespace: dnsmc (This is the name of the delegated subzone you want to create).
hosted-zone: hashidemos.io (Hosted domain on Route53).
General Environment Variables
CONFIRM_DESTROY: 1
(This is so that you don't accidentally delete your zones).
Type in
1cd ~
2mkdir dns-multicloud
3git init
Creating the working environment
Open a terminal and navigate to the directory where you want to store this code.
There are many ways that people split their Terraform code up to make it easier to know where resources are. I prefer to split my Terraform code into areas of concern for this example.
Create the files needed. Type in
1touch general.tf
2touch variables.tf
3touch outputs.tf
The current repository looks like this.
1 => tree
2 .
3 ├── LICENSE
4 ├── README.md
5 ├── general.tf
6 ├── outputs.tf
7 └── variables.tf
8 0 directories, 6 files
general.tf file to declare our general Terraform configuration .e.g. Our remote configuration to use Terraform Cloud as our backend cloud provider specific configuration.
outputs.tf file that will be used to output the information needed to use these delegated zone when deploying infrastructure to our cloud providers.
variables.tf file that will be used to declare the Terraform code that asks for the variables needed to run our code.
I also added a .gitignore for Terraform, LICENSE and a README.md for the repository.
Commit these files to the git history.
Adding the backend
To start working with Terraform you need to configure a remote backed for the Terraform plan.
You can open the general.tf file and add the following.
1terraform {
2 required_version = ">= 0.11.0"
3 backend "remote" {
4 hostname = "app.terraform.io"
5 organization = "dns-multicloud-org"
6 workspaces {
7 name = "dns-multicloud"
8 }
9 }
10}
There are a number of fields here. required_version (Version of the Terraform cli you are using). backend "remote" (This tells Terraform you want to use the remote backend). hostname (Hostname for Terraform Cloud). organization (Our organization). workspaces (The workspace you will be using).
You have one more step to do before can test this configuration. You need to authenticate against Terraform Cloud. There are multiple ways to do this. You can find the documentation here: https://www.terraform.io/docs/commands/cli-config.html#credentials
I will be using a Token that you can generate in the Token Section of your account.
Navigate to your user settings section and generate a new Token to use.
Make sure you copy the token to a safe place as it is only displayed the one time.
You need to add this token to a credentials file to use when you run our Terraform. For a *nix based system you will use a file called .terraformrc in your home directory.
The structure of the file looks like this.
1credentials "app.terraform.io" {
2 token = "INSERTTOKENHERE"
3 }
Insert the token code into this file and save it. Now you are ready to test if your local client can connect to Terraform Cloud. You should make sure you are in the dns-multicloud directory you can do this by typing the following commands and pressing enter after each one.
1pwd
2/Users/lance/dns-multicloud
Initialising The Terraform Cloud Backend
To test that you have everything configured correctly run the following command.
terraform init
You should see the following output in the console.
1Initializing the backend…
2 Successfully configured the backend "remote"! Terraform will automatically
3 use this backend unless the backend configuration changes.
4 Terraform has been successfully initialized!
5 You may now begin working with Terraform. Try running "terraform plan" to see
6 any changes that are required for your infrastructure. All Terraform commands
7 should now work.
8 If you ever set or change modules or backend configuration for Terraform,
9 rerun this command to reinitialize your working directory. If you forget, other
10 commands will detect it and remind you to do so if necessary.
After that you want to initiate the state file in the backend.
1terraform plan
2 Running plan in the remote backend. Output will stream here. Pressing Ctrl-C
3 will stop streaming the logs, but will not stop the plan running remotely.
4 Preparing the remote plan…
5 To view this run in a browser, visit:
6 https://app.terraform.io/app/dns-multicloud-org/dns-multicloud/runs/run-N4hkB4m81kVaP1QG
7 Waiting for the plan to start…
8 Terraform v0.12.9
9 Configuring remote state backend…
10 Initializing Terraform configuration…
11 2019/10/07 11:57:37 [DEBUG] Using modified User-Agent: Terraform/0.12.9 TFC/3bcf15d045
12 Refreshing Terraform state in-memory prior to plan…
13 The refreshed state will be used to calculate this plan, but will not be
14 persisted to local or remote state storage.
15
16 No changes. Infrastructure is up-to-date.
17 This means that Terraform did not detect any differences between your
18 configuration and real physical resources that exist. As a result, no
19 actions need to be performed.
When these two commands complete successfully then we are now ready to start writing our Terraform configuration.
Open the variables.tf file in your editor and create the following items.
1# General
2variable "owner" {
3 description = "Person Deploying this Stack e.g. john-doe"
4}
5
6variable "namespace" {
7 description = "Name of the zone e.g. demo"
8}
9
10variable "created-by" {
11 description = "Tag used to identify resources created programmatically by Terraform"
12 default = "terraform"
13}
14
15variable "hosted-zone" {
16 description = "The name of the dns zone on Route 53 that will be used as the master zone "
17}
The description in the variables explains what each one does.
Commit the changes to git.
Creating the DNS zones
Now that we have bootstrapped the plan we now need to start configuring the zones.
As mentioned before we have a hosted zone in Route53 that we will use as the master zone and from that we will create 3 delegated sub zones in each cloud provider. Starting with AWS we will create our delegated zone in AWS.
Amazon Web Services (AWS) Sub Zone
We now need to add the AWS configuration to our zone. To connect to AWS we need to use a Terraform provider that will give us this ability. In the general.tf file add the following lines below the Remote backend configuration.
1# AWS General Configuration
2provider "aws" {
3 version = "~> 2.0"
4 region = var.aws_region
5}
This block of code tells Terraform that we want to use the AWS provider from the registry in our plan.
We are telling it that we want to use version 2.0 of the provider and we have an extra configuration item called region
. This is the region we want to use for our deployments. We have set another variable here called aws_region
which we will add to the Terraform Cloud configurastion later in the post.
You can read more about the provider block here:
https://www.terraform.io/docs/providers/aws/index.html
Now create a file in the project called aws.tf. You can do this in the same way we did before by using touch in the console.
1touch aws.tf
The directory structure should look like this.
1=> tree
2 .
3 ├── LICENSE
4 ├── README.md
5 ├── aws.tf
6 ├── general.tf
7 ├── outputs.tf
8 └── variables.tf
9 0 directories, 6 files
Open the aws.tf
file in your editor and add the following block of code.
1data "aws_route53_zone" "main" {
2 name = var.hosted-zone
3}
This is a data source block that will query AWS for the zone we have hosted there and return the resource for us to use in our code later. You can read more about the data sources here: https://www.terraform.io/docs/configuration/data-sources.html
AWS Sub Zone
The next step is to create the DNS subzone that we will be using. You must add the code listed below to the aws.tf file just after the data source.
1# AWS SUBZONE
2
3resource "aws_route53_zone" "aws_sub_zone" {
4 name = "${var.namespace}.aws.${var.hosted-zone}"
5 comment = "Managed by Terraform, Delegated Sub Zone for AWS for ${var.namespace}"
6
7 tags = {
8 name = var.namespace
9 owner = var.owner
10 created-by = var.created-by
11 }
12}
What we are doing here is using the aws_route53_zone resource from the provider with a name we have chosen aws_sub_zone we have then provided a number of arguments to the resource so that it can be created. The important ones are the name
argument where we have used two variables to create our zone name.
In this case it would form a domain of dnsmc.aws.hashidemos.io
We have also populated the tags from the other general variables we created.
The block above only creates the zone in AWS but does not provide the master zone with any information on the zone. We need to create some DNS nameserver(ns) records for the new delegated zone so that any records that are created in the new zone will be found. The code block below will create the nameserver(ns) records for the zone .
1resource "aws_route53_record" "aws_sub_zone_ns" {
2 zone_id = "${data.aws_route53_zone.main.zone_id}"
3 name = "${var.namespace}.aws.${var.hosted-zone}"
4 type = "NS"
5 ttl = "30"
6
7 records = [
8 for awsns in aws_route53_zone.aws_sub_zone.name_servers:
9 awsns
10 ]
11}
The important section here is the records
section. You can see that we use a for loop in the section to grab all the name servers that were created in the aws_route53_zone
block we created earlier and populate them in this argument.
We now need to create the variable block in our variables.tf file for the aws_region argument we used in our provider block. The code Block will look like this.
1# AWS
2
3variable "aws_region" {
4 description = "The region to create resources."
5 default = "eu-west-2"
6}
When you need to use this zone in AWS for creating records for other resources you will need the zone ID. To provide this we need to create a block in the outputs.tf file that provides this detail. Add the blocks below to the outputs.tf file.
1output "aws_sub_zone_id" {
2 value = aws_route53_zone.aws_sub_zone.zone_id
3}
4
5output "aws_sub_zone_nameservers" {
6 value = aws_route53_zone.aws_sub_zone.name_servers
7}
This creates two outputs the zone_id output to be referenced in other deployments and a list of the name servers that were assigned to the delegated domain.
This completes the configuration we need to create the resources for the plan.
To apply these to our account we will need to add some authentication credentials for AWS to our Terraform Cloud workspace. We will also need to add the aws_region
variable.
Below are the variables we need to create. Please take note that the Environment Variables need to be marked as sensitive when you create them to encrypt them when they are stored.
AWS Variables
aws_region: eu-west-2
(Region to deploy the delegated domain).
AWS Environment Variables
Mark these as sensitive so that they are hidden You can get these from your AWS account
1AWS_ACCESS_KEY_ID: [AWSACCESSKEY]
2AWS_SECRET_ACCESS_KEY: [AWSSECRETACCESSKEY]
The variable screen will look like this when you are done.
We can now run our terraform plan
to see what will be created.
1=> terraform plan
2 Running plan in the remote backend. Output will stream here. Pressing Ctrl-C
3 will stop streaming the logs, but will not stop the plan running remotely.
4 Preparing the remote plan…
5 To view this run in a browser, visit:
6 https://app.terraform.io/app/dns-multicloud-org/dns-multicloud/runs/run-Ek1ZvYEfAkMHyTqb
7 Waiting for the plan to start…
8 Terraform v0.12.9
9 Configuring remote state backend…
10 Initializing Terraform configuration…
11 2019/10/07 14:46:51 [DEBUG] Using modified User-Agent: Terraform/0.12.9 TFC/3bcf15d045
12 Refreshing Terraform state in-memory prior to plan…
13 The refreshed state will be used to calculate this plan, but will not be
14 persisted to local or remote state storage.
15 data.aws_route53_zone.main: Refreshing state…
16
17 An execution plan has been generated and is shown below.
18 Resource actions are indicated with the following symbols:
19 create
20 Terraform will perform the following actions:
21 # aws_route53_record.aws_sub_zone_ns will be created
22 resource "aws_route53_record" "aws_sub_zone_ns" {
23 allow_overwrite = (known after apply)
24 fqdn = (known after apply)
25 id = (known after apply)
26 name = "dnsmc.aws.hashidemos.io"
27 records = (known after apply)
28 ttl = 30
29 type = "NS"
30 zone_id = "Z2VGUC188F45PC"
31 }
32 aws_route53_zone.aws_sub_zone will be created
33 resource "aws_route53_zone" "aws_sub_zone" {
34 comment = "Managed by Terraform, Delegated Sub Zone for AWS for dnsmc"
35 force_destroy = false
36 id = (known after apply)
37 name = "dnsmc.aws.hashidemos.io"
38 name_servers = (known after apply)
39 tags = { "created-by" = "terraform"
40 "name" = "dnsmc"
41 "owner" = "dns-demo-team"
42 }
43 vpc_id = (known after apply)
44 vpc_region = (known after apply)
45 zone_id = (known after apply)
46 }
47 Plan: 2 to add, 0 to change, 0 to destroy.
Commit the changes to git.
You can now run terraform apply
to create these resources in AWS
You should see something similar to what is below.
1Plan: 2 to add, 0 to change, 0 to destroy.
2 Do you want to perform these actions in workspace "dns-multicloud"?
3 Terraform will perform the actions described above.
4 Only 'yes' will be accepted to approve.
5 Enter a value: yes
6 aws_route53_zone.aws_sub_zone: Creating…
7 aws_route53_zone.aws_sub_zone: Still creating… [10s elapsed]
8 aws_route53_zone.aws_sub_zone: Still creating… [20s elapsed]
9 aws_route53_zone.aws_sub_zone: Still creating… [30s elapsed]
10 aws_route53_zone.aws_sub_zone: Creation complete after 37s [id=Z2MPGT7J02JUKT]
11 aws_route53_record.aws_sub_zone_ns: Creating…
12 aws_route53_record.aws_sub_zone_ns: Still creating… [10s elapsed]
13 aws_route53_record.aws_sub_zone_ns: Still creating… [20s elapsed]
14 aws_route53_record.aws_sub_zone_ns: Still creating… [30s elapsed]
15 aws_route53_record.aws_sub_zone_ns: Creation complete after 30s [id=Z2VGUC188F45PC_dnsmc.aws.hashidemos.io_NS]
16 Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
17 Outputs:
18 aws_sub_zone_id = Z2MPGT7J02JUKT
19 aws_sub_zone_nameservers = [
20 "ns-1441.awsdns-52.org",
21 "ns-1595.awsdns-07.co.uk",
22 "ns-365.awsdns-45.com",
23 "ns-852.awsdns-42.net",
24 ]
Congratulations the AWS zone is created.
Google Cloud Platform (GCP) Sub Zone
The process for the Google Compute zone will be largely the same.
Open the general.tf file in your editor and add the code block below the AWS config block.
1# Google Cloud Platform General Configuration
2provider "google" {
3 version = "~> 2.9"
4 project = var.gcp_project
5 region = var.gcp_region
6}
This block of code describes the GCP provider for Terraform to use when creating the delegated zone on GCP DNS. It has similar arguments that the AWS one has and you can read more about it here https://www.terraform.io/docs/providers/google/index.html
Next you need to create is the gcp.tf file where we will be storing the details for the gcp zone resource. Create the file in the same way as before with the touch command.
1touch gcp.tf
The directory structure should look like this.
1=> tree
2 .
3 ├── LICENSE
4 ├── README.md
5 ├── aws.tf
6 ├── gcp.tf
7 ├── general.tf
8 ├── outputs.tf
9 └── variables.tf
10 0 directories, 7 files
Open the gcp.tf file in your editor and add the code blocks below.
1# GCP SUBZONE
2
3resource "google_dns_managed_zone" "gcp_sub_zone" {
4 name = "${var.namespace}-zone"
5 dns_name = "${var.namespace}.gcp.${var.hosted-zone}."
6 project = var.gcp_project
7 description = "Managed by Terraform, Delegated Sub Zone for GCP for ${var.namespace}"
8 labels = {
9 name = var.namespace
10 owner = var.owner
11 created-by = var.created-by
12 }
13}
The Code block above does much the same as the AWS one.
The data source google_compute_zones
collects all the zones available within the region you have chosen.
There is a difference to the dns_name
argument for the zone. GCP requires you to add a "." to the end of the zone when you create it.
The project argument is the name of the GCP project you are working in.
You now need to add the variables needed to the variables.tf file. Open the viariables.tf file in your editor and add the code block below.
1# GCP
2
3variable "gcp_project" {
4 description = "GCP project name"
5}
6
7variable "gcp_region" {
8 description = "GCP region, e.g. us-east1"
9 default = "europe-west3"
10}
Here you add variables for the gcp_project
and gcp_region
that are needed to authenticate and apply to GCP.
Now you need to add the outputs that are needed for using this zone in other Terraform deployments. Add the code block below to provide the outputs.
1output "gcp_dns_zone_name" {
2 value = google_dns_managed_zone.gcp_sub_zone.name
3}
4
5output "gcp_dns_zone_nameservers" {
6 value = google_dns_managed_zone.gcp_sub_zone.name_servers
7}
Te is it for the resources now you need to configure Terraform with the variables needed for authentication and provisioning.
GCP Variables
gcp_project: dns-multicloud-demo
(Name of the GCP project to deploy to).
gcp_region: europe-west3
(GCP Region for the deployment).
The Environment variable below enables authentication to google cloud.
GCP Environment variables (Sensitive)
GOOGLE_CREDENTIALS: [json]
What needs to be added here is the contents of the json file that you can download from your GCP account . Terraform Cloud needs the credentials in a specific format .
Save your google credentials into the project directory. Using your editor edit the file you downloaded.
You need to convert the json into one single line. If you have access to vim you can use the steps below.
1vim gcp-credentials.json
2
3then press :
4
5enter the following
6%s;n; ;g
7
8Press enter
9
10Save the file by pressing : then wq and press enter
After doing these steps if you open the file in your normal editor it should all be on one line. Copy the text from this file into the GOOGLE_CREDENTIALS
Environment variable and mark it as secret.
The variable screen will look like this when you are done.
You then run terraform plan
and terraform apply
and the outputs should look something like this.
1Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
2 Outputs:
3 aws_sub_zone_id = Z2MPGT7J02JUKT
4 aws_sub_zone_nameservers = [
5 "ns-1441.awsdns-52.org",
6 "ns-1595.awsdns-07.co.uk",
7 "ns-365.awsdns-45.com",
8 "ns-852.awsdns-42.net",
9 ]
10 gcp_dns_zone_name = dnsmc-zone
11 gcp_dns_zone_nameservers = [
12 "ns-cloud-b1.googledomains.com.",
13 "ns-cloud-b2.googledomains.com.",
14 "ns-cloud-b3.googledomains.com.",
15 "ns-cloud-b4.googledomains.com.",
16 ]
Congratulations the GCP zone is created.
Commit the changes to git
Azure Cloud Platform (Azure) Sub Zone
The creation of this zone should be largely the same as the AWS and GCP ones.
Open the general.tf file in your editor and add the code block below the GCP config block.
1# Azure General Configuration
2provider "azurerm" {
3 version = "~>1.32.1"
4}
This block of code describes the Azure provider for Terraform to use when creating the delegated zone on Azure DNS. It has similar arguments that the AWS and GCP ones have and you can read more about it here: https://www.terraform.io/docs/providers/azurerm/index.html
Next you need to create is the azure.tf file where we will be storing the details for the azure zone resource. Create the file in the same way as before with the touch command.
1touch azure.tf
The directory structure should look like this.
1=> tree
2 .
3 ├── LICENSE
4 ├── README.md
5 ├── aws.tf
6 ├── azure.tf
7 ├── gcp.tf
8 ├── general.tf
9 ├── outputs.tf
10 └── variables.tf
11 0 directories, 8 files
Open the azure.tf file in your editor and add the code blocks below.
1resource "azurerm_resource_group" "dns_resource_group" {
2 name = "${var.namespace}DNSrg"
3 location = var.azure_location
4}
5
6resource "azurerm_dns_zone" "azure_sub_zone" {
7 name = "${var.namespace}.azure.${var.hosted-zone}"
8 resource_group_name = "${azurerm_resource_group.dns_resource_group.name}"
9 tags = {
10 name = var.namespace
11 owner = var.owner
12 created-by = var.created-by
13 }
14}
The code block above does petty much the same as the other two.
The resource azurerm_resource_group
creates a resource group for the DNS zone.
The location argument determines where the resource Group and zone will be deployed.
The resource azurerm_dns_zone
creates the zone in the resource group.
Next you need to add the variable in the variables.tf file. Open the variables.tf file in your editor and add the code block below.
1# Azure
2
3variable "azure_location" {
4 description = "The azure location to deploy the DNS service"
5 default = "West Europe"
6}
We only have one variable here to determine which location the zone will be deployed.
The last bit of code you need to create is the outputs in the outputs.tf file. Add the code block below to the outputs.tf file after the GCP ones.
1output "azure_sub_zone_name" {
2 value = azurerm_dns_zone.azure_sub_zone.id
3}
4
5output "azure_sub_zone_nameservers" {
6 value = azurerm_dns_zone.azure_sub_zone.name_servers
7}
8
9output "azure_dns_resourcegroup" {
10 value = azurerm_resource_group.dns_resource_group.name
11}
As before we need to output the details that will be needed to deploy resources and create DNS records in the zone.
You now need to add the Variables for the Azure deployment.
Azure Variables
azure_location: West Europe
The Azure Region Location to deploy to.
Azure Variables (Sensitive)
1ARM_SUBSCRIPTION_ID: [ARMSUBID]
2ARM_CLIENT_ID: [ARMCLIENTID]
3ARM_CLIENT_SECRET: [ARMCLIENTSECRET]
4ARM_TENANT_ID: [ARMTENANTID]
These credentials you can get from your Azure Service Principal account.
The variable screen will look like this when you are done.
Commit the changes to git.
The final piece of the puzzle is to now make the AWS DNS servers aware of where the different GCP and Azure DNS zones are hosted. Open the aws.tf file with your editor and add the code blocks below after the AWS blocks.
1# GCP SubZone
2
3resource "aws_route53_zone" "gcp_sub_zone" {
4 name = "${var.namespace}.gcp.${var.hosted-zone}"
5 comment = "Managed by Terraform, Delegated Sub Zone for GCP for ${var.namespace}"
6 force_destroy = false
7 tags = {
8 name = var.namespace
9 owner = var.owner
10 created-by = var.created-by
11 }
12}
13
14 resource "aws_route53_record" "gcp_sub_zone" {
15 zone_id = "${data.aws_route53_zone.main.zone_id}"
16 name = "${var.namespace}.gcp.${var.hosted-zone}"
17 type = "NS"
18 ttl = "30"
19
20 records = [
21 for gcpns in google_dns_managed_zone.gcp_sub_zone.name_servers:
22 gcpns
23 ]
24 }
25
26# Azure SUBZONE
27
28resource "aws_route53_zone" "azure_sub_zone" {
29 name = "${var.namespace}.azure.${var.hosted-zone}"
30 comment = "Managed by Terraform, Delegated Sub Zone for Azure for ${var.namespace}"
31
32 tags = {
33 name = var.namespace
34 owner = var.owner
35 created-by = var.created-by
36 }
37}
38
39resource "aws_route53_record" "azure_sub_zone_ns" {
40 zone_id = "${data.aws_route53_zone.main.zone_id}"
41 name = "${var.namespace}.azure.${var.hosted-zone}"
42 type = "NS"
43 ttl = "30"
44
45 records = [
46 for azurens in azurerm_dns_zone.azure_sub_zone.name_servers:
47 azurens
48 ]
49}
In these code blocks you are creating the delegated zones in Route53 and providing the DNS name servers from each cloud zone as records.
Save the file and the run terraform plan
and terraform apply
You should get results similar to this.
1Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
2 Outputs:
3 aws_sub_zone_id = Z2MPGT7J02JUKT
4 aws_sub_zone_nameservers = [
5 "ns-1441.awsdns-52.org",
6 "ns-1595.awsdns-07.co.uk",
7 "ns-365.awsdns-45.com",
8 "ns-852.awsdns-42.net",
9 ]
10 azure_dns_resourcegroup = dnsmcDNSrg
11 azure_sub_zone_name = /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dnsmcdnsrg/providers/Microsoft.Network/dnszones/dnsmc.azure.hashidemos.io
12 azure_sub_zone_nameservers = [
13 "ns1-02.azure-dns.com.",
14 "ns2-02.azure-dns.net.",
15 "ns3-02.azure-dns.org.",
16 "ns4-02.azure-dns.info.",
17 ]
18 gcp_dns_zone_name = dnsmc-zone
19 gcp_dns_zone_nameservers = [
20 "ns-cloud-b1.googledomains.com.",
21 "ns-cloud-b2.googledomains.com.",
22 "ns-cloud-b3.googledomains.com.",
23 "ns-cloud-b4.googledomains.com.",
24 ]
After this step your DNS zones will be available in each cloud provider for your services to use as needed. If you ever need to add another cloud provider just follow the same process as with these.
The git repository for this blog post can be found here : https://github.com/lhaig/dns-multicloud