Skip to content

Instantly share code, notes, and snippets.

@jhanley-com
Last active March 7, 2021 23:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhanley-com/63a2cc54734f18b3b76a42bca4b74e2b to your computer and use it in GitHub Desktop.
Save jhanley-com/63a2cc54734f18b3b76a42bca4b74e2b to your computer and use it in GitHub Desktop.
# This script is used in my article about Terraform, Google Cloud DNS and Cloud IAM.
# https://www.jhanley.com/terraform-experiments-with-google-cloud-dns-and-iam/
######################################################################
# Terraform
######################################################################
terraform {
required_version = ">= 0.14.7"
}
######################################################################
# Google Cloud Provider
######################################################################
provider "google" {
credentials = var.gcp_service_account
project = var.gcp_project
}
######################################################################
# variables for Google Cloud Provider
######################################################################
variable "gcp_project" {
description = "Google Cloud Project ID"
}
variable "gcp_service_account" {
description = "Service Account filename for Authorization"
}
######################################################################
# variables for the Google Cloud DNS Managed Zone
######################################################################
variable "zonename" {
description = "Google Cloud DNS Zone Name (not the domain name)"
default = "myexample-com"
}
######################################################################
# access the Cloud DNS Zone attributes
######################################################################
data "google_dns_managed_zone" "dns_zone" {
name = var.zonename
}
######################################################################
#
######################################################################
output "gcp_dns_zone" {
value = data.google_dns_managed_zone.dns_zone
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment