Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GCP and DNSimple dual DNS records with Terraform
module "deps_dns_app_v6" {
source = "../modules/dns_record"
name = "app"
type = "AAAA"
value = "${google_compute_global_address.deps-ipv6.address}"
}
module "deps_return_path" {
source = "../modules/dns_record"
name = "return-path"
type = "CNAME"
ttl = 3600
value = "pm.mtasv.net"
}
# Note this only works for CNAMEs and A/AAAA records.
variable "domain" {
default = "deps.co"
}
variable "name" {}
variable "type" {}
variable "value" {}
variable "ttl" {
default = 300
}
variable "shared_project" {
default = "my-shared-project"
}
variable "managed_zone" {
default = "my-managed-zone"
}
resource "google_dns_record_set" "record" {
name = "${var.name}.${var.domain}."
type = "${var.type}"
ttl = "${var.ttl}"
managed_zone = "${var.managed_zone}"
project = "${var.shared_project}"
rrdatas = ["${var.type == "CNAME" ? "${var.value}." : var.value}"]
}
resource "dnsimple_record" "record" {
domain = "${var.domain}"
name = "${var.name}"
type = "${var.type}"
ttl = "${var.ttl}"
value = "${var.value}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.