PowerDNS Turrangrunt
[root@atlantis-test-cc a_records]# cat terragrunt.hcl
locals {
# ========= This Workspace Config
ws_data = yamldecode(file("workspace_params.yml"))
wf_data = yamldecode(file("workflow_params.yml"))
tf_lib_module_release = local.wf_data.tf_code.release_tag
}
terraform {
source = "${local.wf_data.tf_code.source_url}//?ref=${local.wf_data.tf_code.release_tag}"
}
#include {
# path = find_in_parent_folders()
#}
inputs = {
pdns_zone = local.ws_data.terragrunt.resources.pdns_zone
# pdns_name = local.ws_data.terragrunt.resources.pdns_name
# pdns_record = local.ws_data.terragrunt.resources.pdns_record
# rtype = local.ws_data.terragrunt.resources.rtype
records1 = {
record0 = {
name = "ps.dctest.io."
pdns_zone = "dctest.io"
type = "A"
ttl = "300"
records = ["10.10.33.198","10.10.33.199"]
}
record1 = {
name = "sp.dctest.io."
pdns_zone = "dctest.io"
type = "A"
ttl = "300"
records = ["10.10.33.218","10.10.33.201"]
}
}
}
==============
[root@atlantis-test-cc a_records]# cat workspace_params.yml
workspace_common:
owner_team: "SysOps-Team"
vault: []
terragrunt:
resources:
# Add A record entry here
pdns_zone: "dctest.io"
# pdns_name: "test101.dctest.io."
# pdns_record: "10.10.10.101"
rtype: "A"
# records1:
post_terragrunt: {} # For future extensions. For now keep empty dict
================
https://github.com/8x8/auto_powerdns_mgmt
resource "powerdns_record" "www" {
# ...
# for_each = var.records1
for_each = { for k, v in var.records1 : k => v }
name = each.value.name
zone = each.value.pdns_zone
type = each.value.type
ttl = each.value.ttl
records = each.value.records
}
===Variables.tf
variable "pdns_api_key" {
type = string
default = "8x8powerdns"
}
variable "pdns_server_url" {
type = string
default = "http://10.170.20.26:8081"
}
variable "pdns_zone" {
type = string
default = "dctest.io"
}
#variable "pdns_name" {
# type = string
# default = "test.dctest.io."
#}
variable "records1" {
type = map(object({
name = string
pdns_zone = string
ttl = string
records = list(string)
type = string
}))
}
Comments
Post a Comment