Skip to content

Eimert/terraform-google-dns-managed-zone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-google-dns-managed-zone

Create a DNS managed zone on Google Cloud. Module in Terraform Registry.

Usage

  1. Create a new directory for this terraform configuration.
  2. Create a main.tf, for example:
# Configure the Google Cloud provider
provider "google" {
  credentials = "${file("king-of-my-google-cloud-castle.json")}"
  project     = "smashing-dash-1992"
}

module "google-dns-managed-zone" {
  source          = "github.com/Eimert/terraform-google-dns-managed-zone"

  dns_name        = "cloud-zone"
  dns_zone        = "cloud.eimertvink.nl."
}
  1. terraform init
  2. terraform plan Boom! Credentials file missing.
  3. Add your google cloud credentials in a .json file. Getting started guide

Keep the Google Cloud credentials in a safe place. Don't push them to Git.

  1. Adapt the Terraform variables in main.tf to match your Google cloud project name, and VM requirements. All optional parameters can be found in variables.tf.
  2. Let terraform fire up the VM's:
terraform apply
  1. Wait a few minutes seconds.
  2. Optionally see the created resources in Google Cloud Console
  3. Break down the resources:
terraform destroy

VM + DNS A record

This module can be used to register a type A (name) DNS record, linking a DNS name to a VM ip address. Terraform usage example in github.com/Eimert/terraform-google-compute-engine-instance.

DNS Managed Zone

Result in google cloud console, after running the example (minus the A record):

My personal domain eimertvink.nl is configured with NS of freedns. This terraform plan configures Google Cloud to act as the NS for the subdomain cloud.eimertvink.nl.

But that's not all. Freedns must forwards dns queries to *.cloud.eimertvink.nl to Google's NS. This is the configuration of freedns:


Now the subdomain cloud.eimertvink.nl is configured to forward queries to Google' nameservers. And Google Cloud is providing DNS for queries to resources under *.cloud.eimertvink.nl.

About

Terraform module for a Google Cloud DNS managed zone

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages