This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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