PowerDNS

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

DOMAIN ADDITION 

[root@atlantis-test-cc auto_multiple_domain_SRJ]# cat main.tf

resource "powerdns_zone" "zone" {

  for_each = { for k, v in var.zones : k => v }

  name = each.value.name

  kind = each.value.kind

  nameservers = each.value.nameservers

}

======

[root@atlantis-test-cc auto_multiple_domain_SRJ]# cat main.tf
resource "powerdns_zone" "zone" {
  for_each = { for k, v in var.zones : k => v }
  name = each.value.name
  kind = each.value.kind
  nameservers = each.value.nameservers
}
[root@atlantis-test-cc auto_multiple_domain_SRJ]# cat 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 "zones" {
 type = list(object({
   name  = string
   kind  = string
   nameservers  = list(string)
   }))
   description = "none"
default = [
    {
     name = "doss.io."
     kind = "Native"
     ttl = 300
     nameservers = ["ns1.doss.io.", "ns2.doss.io."]
    },
    {
     name = "moss.io."
     kind = "Native"
     ttl = 300
     nameservers = ["ns1.moss.io.", "ns2.moss.io."]
    }
]
}
[root@atlantis-test-cc auto_multiple_domain_SRJ]# cat main.tf
resource "powerdns_zone" "zone" {
  for_each = { for k, v in var.zones : k => v }
  name = each.value.name
  kind = each.value.kind
  nameservers = each.value.nameservers
}
[root@atlantis-test-cc auto_multiple_domain_SRJ]# cat main.tf
resource "powerdns_zone" "zone" {
  for_each = { for k, v in var.zones : k => v }
  name = each.value.name
  kind = each.value.kind
  nameservers = each.value.nameservers
}
[root@atlantis-test-cc auto_multiple_domain_SRJ]# car variables.tf
-bash: car: command not found
[root@atlantis-test-cc auto_multiple_domain_SRJ]# cat 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 "zones" {
 type = list(object({
   name  = string
   kind  = string
   nameservers  = list(string)
   }))
   description = "none"
default = [
    {
     name = "doss.io."
     kind = "Native"
     ttl = 300
     nameservers = ["ns1.doss.io.", "ns2.doss.io."]
    },
    {
     name = "moss.io."
     kind = "Native"
     ttl = 300
     nameservers = ["ns1.moss.io.", "ns2.moss.io."]
    }
]
}

====


terraform {
  required_providers {
    powerdns = {
      source = "pan-net/powerdns"
      version = "1.5.0"
    }
  }
}


provider "powerdns" {
  # Configuration options

  api_key    = "${var.pdns_api_key}"
  server_url = "${var.pdns_server_url}"
#  insecure_https = true
#  cache_requests = true
}


============RECORD ADDED

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.zone
  type    = each.value.type
  ttl     = each.value.ttl
  records = each.value.records
}



[root@atlantis-test-cc test-directory-srj]# cat main.tf
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.zone
  type    = each.value.type
  ttl     = each.value.ttl
  records = each.value.records
}



[root@atlantis-test-cc test-directory-srj]# cat 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 = list(object({
   name  = string
   zone  = string
   ttl   = string
   records  = list(string)
   type  = string
   }))
   description = "none"
default = [
    {
     zone = "dctest.io"
     name = "dinesh.dctest.io."
     type = "A"
     ttl = 300
     records = ["10.10.33.166"]
    },
    {
     zone = "dctest.io"
     name = "dinesh1.dctest.io."
     type = "A"
     ttl = "300"
     records =  ["10.10.33.133","10.10.44.155"]
    }
]
}



---

Comments

Popular posts from this blog

Terraform : AWS : Terraform on AWS with SRE & IaC DevOps | Section 2 : Terraform basics

Terraform : AWS : Terraform on AWS | Section 4: Terraform Input Variables and Datasources

Terraform VPC - on AWS : Three tier architecture design