Skip to content

Instantly share code, notes, and snippets.

@josiahhaswell
Created February 22, 2021 21:54
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 josiahhaswell/eb91046c96b447c28f5d5829e37ca102 to your computer and use it in GitHub Desktop.
Save josiahhaswell/eb91046c96b447c28f5d5829e37ca102 to your computer and use it in GitHub Desktop.
dns/main.tf
terraform {
required_providers {
dns = {
source = "hashicorp/dns"
}
}
}
/**
provision DNS entries for each host in the `hosts` list
*/
resource "dns_a_record_set" "virtual_machine_dns" {
for_each = {for vm in var.hosts: vm.name => vm}
zone = var.dns_server.zone
name = each.value.name
addresses = [
each.value.ip
]
}
/**
provision the DNS A-record for the API server
*/
resource "dns_a_record_set" "api_server_dns" {
addresses = [
var.api_ip
]
zone = var.dns_server.zone
name = var.api_dns
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment