зеркало из https://github.com/Azure/Avere.git
add proxy capability to dns server (#1270)
This commit is contained in:
Родитель
59607e8c30
Коммит
2948367800
|
@ -123,6 +123,8 @@ locals {
|
|||
script_file_b64 = base64gzip(replace(file("${path.module}/install.sh"), "\r", ""))
|
||||
unbound_conf_file_b64 = base64gzip(replace(templatefile("${path.module}/unbound.conf", { max_ttl = var.dns_max_ttl_seconds, excluded_subnets = local.excluded_subnets_str, local_zone_line = local.local_zone_record_str, arecord_lines = local.local_a_records_str, forward_addr_lines = local.foward_lines_str }), "\r", ""))
|
||||
cloud_init_file = templatefile("${path.module}/cloud-init.tpl", { installcmd = local.script_file_b64, unboundconf = local.unbound_conf_file_b64, ssh_port = var.ssh_port })
|
||||
|
||||
proxy_env = (var.proxy == null || var.proxy == "") ? "" : "http_proxy=${var.proxy} https_proxy=${var.proxy} no_proxy=169.254.169.254"
|
||||
}
|
||||
|
||||
data "azurerm_subnet" "vnet" {
|
||||
|
@ -193,7 +195,7 @@ resource "azurerm_virtual_machine_extension" "cse" {
|
|||
|
||||
settings = <<SETTINGS
|
||||
{
|
||||
"commandToExecute": " /bin/bash /opt/install.sh"
|
||||
"commandToExecute": " ${var.proxy_env} /bin/bash /opt/install.sh"
|
||||
}
|
||||
SETTINGS
|
||||
}
|
||||
|
|
|
@ -3,17 +3,17 @@ variable "resource_group_name" {
|
|||
}
|
||||
|
||||
variable "location" {
|
||||
description = "The Azure Region into which the dnsserver will be created."
|
||||
description = "The Azure Region into which the dnsserver will be created."
|
||||
}
|
||||
|
||||
variable "admin_username" {
|
||||
description = "Admin username on the dnsserver."
|
||||
default = "azureuser"
|
||||
default = "azureuser"
|
||||
}
|
||||
|
||||
variable "admin_password" {
|
||||
description = "(optional) The password used for access to the dnsserver. If not specified, ssh_key_data needs to be set."
|
||||
default = null
|
||||
default = null
|
||||
}
|
||||
|
||||
variable "ssh_key_data" {
|
||||
|
@ -22,17 +22,17 @@ variable "ssh_key_data" {
|
|||
|
||||
variable "ssh_port" {
|
||||
description = "specifies the tcp port to use for ssh"
|
||||
default = 22
|
||||
default = 22
|
||||
}
|
||||
|
||||
variable "unique_name" {
|
||||
description = "The unique name used for the dnsserver and for resource names associated with the VM."
|
||||
default = "dnsserver"
|
||||
default = "dnsserver"
|
||||
}
|
||||
|
||||
variable "vm_size" {
|
||||
description = "Size of the VM."
|
||||
default = "Standard_D2s_v3"
|
||||
default = "Standard_D2s_v3"
|
||||
}
|
||||
|
||||
variable "virtual_network_resource_group" {
|
||||
|
@ -49,7 +49,7 @@ variable "virtual_network_subnet_name" {
|
|||
|
||||
variable "private_ip_address" {
|
||||
description = "specifies a static private ip address to use"
|
||||
default = null
|
||||
default = null
|
||||
}
|
||||
|
||||
variable "dns_server" {
|
||||
|
@ -58,52 +58,52 @@ variable "dns_server" {
|
|||
|
||||
variable "excluded_subnet_cidrs" {
|
||||
description = "the list of excluded subnets from spoofing. The Cache should be in this subnet."
|
||||
default = []
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "avere_address_list" {
|
||||
description = "the list of addresses from the Avere vserver."
|
||||
default = []
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "avere_first_ip_addr" {
|
||||
description = "the first ip address of the Avere vserver."
|
||||
default = ""
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "avere_ip_addr_count" {
|
||||
description = "the count of ip addresses on the vserver."
|
||||
default = 0
|
||||
default = 0
|
||||
}
|
||||
|
||||
variable "avere_first_ip_addr2" {
|
||||
description = "the first ip address of the Avere vserver2."
|
||||
default = ""
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "avere_ip_addr_count2" {
|
||||
description = "the count of ip addresses on the vserver2."
|
||||
default = 0
|
||||
default = 0
|
||||
}
|
||||
|
||||
variable "avere_first_ip_addr3" {
|
||||
description = "the first ip address of the Avere vserver3."
|
||||
default = ""
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "avere_ip_addr_count3" {
|
||||
description = "the count of ip addresses on the vserver3."
|
||||
default = 0
|
||||
default = 0
|
||||
}
|
||||
|
||||
variable "avere_first_ip_addr4" {
|
||||
description = "the first ip address of the Avere vserver4."
|
||||
default = ""
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "avere_ip_addr_count4" {
|
||||
description = "the count of ip addresses on the vserver4."
|
||||
default = 0
|
||||
default = 0
|
||||
}
|
||||
|
||||
variable "avere_filer_fqdn" {
|
||||
|
@ -112,10 +112,15 @@ variable "avere_filer_fqdn" {
|
|||
|
||||
variable "dns_max_ttl_seconds" {
|
||||
description = "The max ttl in seconds of the dns records, the default is 5 minutes. This will cap larger TTLS, and TTLs set lower than this value will still be respected."
|
||||
default = 300
|
||||
default = 300
|
||||
}
|
||||
|
||||
variable "avere_filer_alternate_fqdn" {
|
||||
default = []
|
||||
default = []
|
||||
description = "alternate fqdn of the avere and is useful to point other names at Avere or can be used to emulate a domain search list."
|
||||
}
|
||||
|
||||
variable "proxy" {
|
||||
description = "specify a proxy address if one exists in the format of http://PROXY_SERVER:PORT"
|
||||
default = null
|
||||
}
|
||||
|
|
|
@ -1,105 +1,107 @@
|
|||
locals {
|
||||
# create the A record lines for the first Avere
|
||||
last_octet = split(".", var.avere_first_ip_addr)[3]
|
||||
last_octet = split(".", var.avere_first_ip_addr)[3]
|
||||
addr_prefix = trimsuffix(var.avere_first_ip_addr, ".${local.last_octet}")
|
||||
# technique from article: https://forum.netgate.com/topic/120486/round-robin-for-dns-forwarder-network-address/3
|
||||
local_a_records = [for i in range(var.avere_ip_addr_count): "local-data: \"${var.avere_filer_fqdn} ${var.dns_max_ttl_seconds} A ${local.addr_prefix}.${local.last_octet + i}\""]
|
||||
local_a_records_reverse = [for i in range(var.avere_ip_addr_count): "local-data-ptr: \"${local.addr_prefix}.${local.last_octet + i} ${var.dns_max_ttl_seconds} ${var.avere_filer_fqdn}\""]
|
||||
|
||||
local_a_records = [for i in range(var.avere_ip_addr_count) : "local-data: \"${var.avere_filer_fqdn} ${var.dns_max_ttl_seconds} A ${local.addr_prefix}.${local.last_octet + i}\""]
|
||||
local_a_records_reverse = [for i in range(var.avere_ip_addr_count) : "local-data-ptr: \"${local.addr_prefix}.${local.last_octet + i} ${var.dns_max_ttl_seconds} ${var.avere_filer_fqdn}\""]
|
||||
|
||||
# alternate fqdn
|
||||
local_alternate_a_records = flatten([
|
||||
for i in range(length(var.avere_filer_alternate_fqdn)): [
|
||||
for j in range(var.avere_ip_addr_count):
|
||||
"local-data: \"${var.avere_filer_alternate_fqdn[i]} ${var.dns_max_ttl_seconds} A ${local.addr_prefix}.${local.last_octet + j}\""
|
||||
]
|
||||
for i in range(length(var.avere_filer_alternate_fqdn)) : [
|
||||
for j in range(var.avere_ip_addr_count) :
|
||||
"local-data: \"${var.avere_filer_alternate_fqdn[i]} ${var.dns_max_ttl_seconds} A ${local.addr_prefix}.${local.last_octet + j}\""
|
||||
]
|
||||
])
|
||||
# reverse records
|
||||
local_alternate_a_records_reverse = flatten([
|
||||
for i in range(length(var.avere_filer_alternate_fqdn)): [
|
||||
for j in range(var.avere_ip_addr_count):
|
||||
"local-data-ptr: \"${local.addr_prefix}.${local.last_octet + j} ${var.dns_max_ttl_seconds} ${var.avere_filer_alternate_fqdn[i]}\""
|
||||
]
|
||||
for i in range(length(var.avere_filer_alternate_fqdn)) : [
|
||||
for j in range(var.avere_ip_addr_count) :
|
||||
"local-data-ptr: \"${local.addr_prefix}.${local.last_octet + j} ${var.dns_max_ttl_seconds} ${var.avere_filer_alternate_fqdn[i]}\""
|
||||
]
|
||||
])
|
||||
|
||||
# create the A record lines for the second Avere
|
||||
last_octet2 = var.avere_first_ip_addr2 == "" ? "" : split(".", var.avere_first_ip_addr2)[3]
|
||||
last_octet2 = var.avere_first_ip_addr2 == "" ? "" : split(".", var.avere_first_ip_addr2)[3]
|
||||
addr_prefix2 = var.avere_first_ip_addr2 == "" ? "" : trimsuffix(var.avere_first_ip_addr2, ".${local.last_octet2}")
|
||||
|
||||
local_a_records2 = var.avere_first_ip_addr2 == "" ? [] : [for i in range(var.avere_ip_addr_count2): "local-data: \"${var.avere_filer_fqdn} ${var.dns_max_ttl_seconds} A ${local.addr_prefix2}.${local.last_octet2 + i}\""]
|
||||
local_a_records_reverse2 = var.avere_first_ip_addr2 == "" ? [] : [for i in range(var.avere_ip_addr_count2): "local-data-ptr: \"${local.addr_prefix2}.${local.last_octet2 + i} ${var.dns_max_ttl_seconds} ${var.avere_filer_fqdn}\""]
|
||||
local_a_records2 = var.avere_first_ip_addr2 == "" ? [] : [for i in range(var.avere_ip_addr_count2) : "local-data: \"${var.avere_filer_fqdn} ${var.dns_max_ttl_seconds} A ${local.addr_prefix2}.${local.last_octet2 + i}\""]
|
||||
local_a_records_reverse2 = var.avere_first_ip_addr2 == "" ? [] : [for i in range(var.avere_ip_addr_count2) : "local-data-ptr: \"${local.addr_prefix2}.${local.last_octet2 + i} ${var.dns_max_ttl_seconds} ${var.avere_filer_fqdn}\""]
|
||||
|
||||
# alternate fqdn
|
||||
local_alternate_a_records2 = var.avere_first_ip_addr2 == "" ? [] : flatten([
|
||||
for i in range(length(var.avere_filer_alternate_fqdn)): [
|
||||
for j in range(var.avere_ip_addr_count2):
|
||||
"local-data: \"${var.avere_filer_alternate_fqdn[i]} ${var.dns_max_ttl_seconds} A ${local.addr_prefix2}.${local.last_octet2 + j}\""
|
||||
]
|
||||
for i in range(length(var.avere_filer_alternate_fqdn)) : [
|
||||
for j in range(var.avere_ip_addr_count2) :
|
||||
"local-data: \"${var.avere_filer_alternate_fqdn[i]} ${var.dns_max_ttl_seconds} A ${local.addr_prefix2}.${local.last_octet2 + j}\""
|
||||
]
|
||||
])
|
||||
# reverse records
|
||||
local_alternate_a_records_reverse2 = var.avere_first_ip_addr2 == "" ? [] : flatten([
|
||||
for i in range(length(var.avere_filer_alternate_fqdn)): [
|
||||
for j in range(var.avere_ip_addr_count2):
|
||||
"local-data-ptr: \"${local.addr_prefix2}.${local.last_octet2 + j} ${var.dns_max_ttl_seconds} ${var.avere_filer_alternate_fqdn[i]}\""
|
||||
]
|
||||
for i in range(length(var.avere_filer_alternate_fqdn)) : [
|
||||
for j in range(var.avere_ip_addr_count2) :
|
||||
"local-data-ptr: \"${local.addr_prefix2}.${local.last_octet2 + j} ${var.dns_max_ttl_seconds} ${var.avere_filer_alternate_fqdn[i]}\""
|
||||
]
|
||||
])
|
||||
|
||||
# create the A record lines for the third Avere
|
||||
last_octet3 = var.avere_first_ip_addr3 == "" ? "" : split(".", var.avere_first_ip_addr3)[3]
|
||||
last_octet3 = var.avere_first_ip_addr3 == "" ? "" : split(".", var.avere_first_ip_addr3)[3]
|
||||
addr_prefix3 = var.avere_first_ip_addr3 == "" ? "" : trimsuffix(var.avere_first_ip_addr3, ".${local.last_octet3}")
|
||||
|
||||
local_a_records3 = var.avere_first_ip_addr3 == "" ? [] : [for i in range(var.avere_ip_addr_count3): "local-data: \"${var.avere_filer_fqdn} ${var.dns_max_ttl_seconds} A ${local.addr_prefix3}.${local.last_octet3 + i}\""]
|
||||
local_a_records_reverse3 = var.avere_first_ip_addr3 == "" ? [] : [for i in range(var.avere_ip_addr_count3): "local-data-ptr: \"${local.addr_prefix3}.${local.last_octet3 + i} ${var.dns_max_ttl_seconds} ${var.avere_filer_fqdn}\""]
|
||||
local_a_records3 = var.avere_first_ip_addr3 == "" ? [] : [for i in range(var.avere_ip_addr_count3) : "local-data: \"${var.avere_filer_fqdn} ${var.dns_max_ttl_seconds} A ${local.addr_prefix3}.${local.last_octet3 + i}\""]
|
||||
local_a_records_reverse3 = var.avere_first_ip_addr3 == "" ? [] : [for i in range(var.avere_ip_addr_count3) : "local-data-ptr: \"${local.addr_prefix3}.${local.last_octet3 + i} ${var.dns_max_ttl_seconds} ${var.avere_filer_fqdn}\""]
|
||||
|
||||
# alternate fqdn
|
||||
local_alternate_a_records3 = var.avere_first_ip_addr3 == "" ? [] : flatten([
|
||||
for i in range(length(var.avere_filer_alternate_fqdn)): [
|
||||
for j in range(var.avere_ip_addr_count3):
|
||||
"local-data: \"${var.avere_filer_alternate_fqdn[i]} ${var.dns_max_ttl_seconds} A ${local.addr_prefix3}.${local.last_octet3 + j}\""
|
||||
]
|
||||
for i in range(length(var.avere_filer_alternate_fqdn)) : [
|
||||
for j in range(var.avere_ip_addr_count3) :
|
||||
"local-data: \"${var.avere_filer_alternate_fqdn[i]} ${var.dns_max_ttl_seconds} A ${local.addr_prefix3}.${local.last_octet3 + j}\""
|
||||
]
|
||||
])
|
||||
# reverse records
|
||||
local_alternate_a_records_reverse3 = var.avere_first_ip_addr3 == "" ? [] : flatten([
|
||||
for i in range(length(var.avere_filer_alternate_fqdn)): [
|
||||
for j in range(var.avere_ip_addr_count3):
|
||||
"local-data-ptr: \"${local.addr_prefix3}.${local.last_octet3 + j} ${var.dns_max_ttl_seconds} ${var.avere_filer_alternate_fqdn[i]}\""
|
||||
]
|
||||
for i in range(length(var.avere_filer_alternate_fqdn)) : [
|
||||
for j in range(var.avere_ip_addr_count3) :
|
||||
"local-data-ptr: \"${local.addr_prefix3}.${local.last_octet3 + j} ${var.dns_max_ttl_seconds} ${var.avere_filer_alternate_fqdn[i]}\""
|
||||
]
|
||||
])
|
||||
|
||||
# create the A record lines for the fourth Avere
|
||||
last_octet4 = var.avere_first_ip_addr4 == "" ? "" : split(".", var.avere_first_ip_addr4)[3]
|
||||
# create the A record lines for the fourth Avere
|
||||
last_octet4 = var.avere_first_ip_addr4 == "" ? "" : split(".", var.avere_first_ip_addr4)[3]
|
||||
addr_prefix4 = var.avere_first_ip_addr4 == "" ? "" : trimsuffix(var.avere_first_ip_addr4, ".${local.last_octet4}")
|
||||
|
||||
local_a_records4 = var.avere_first_ip_addr4 == "" ? [] : [for i in range(var.avere_ip_addr_count4): "local-data: \"${var.avere_filer_fqdn} ${var.dns_max_ttl_seconds} A ${local.addr_prefix4}.${local.last_octet4 + i}\""]
|
||||
local_a_records_reverse4 = var.avere_first_ip_addr4 == "" ? [] : [for i in range(var.avere_ip_addr_count4): "local-data-ptr: \"${local.addr_prefix4}.${local.last_octet4 + i} ${var.dns_max_ttl_seconds} ${var.avere_filer_fqdn}\""]
|
||||
local_a_records4 = var.avere_first_ip_addr4 == "" ? [] : [for i in range(var.avere_ip_addr_count4) : "local-data: \"${var.avere_filer_fqdn} ${var.dns_max_ttl_seconds} A ${local.addr_prefix4}.${local.last_octet4 + i}\""]
|
||||
local_a_records_reverse4 = var.avere_first_ip_addr4 == "" ? [] : [for i in range(var.avere_ip_addr_count4) : "local-data-ptr: \"${local.addr_prefix4}.${local.last_octet4 + i} ${var.dns_max_ttl_seconds} ${var.avere_filer_fqdn}\""]
|
||||
|
||||
# alternate fqdn
|
||||
local_alternate_a_records4 = var.avere_first_ip_addr4 == "" ? [] : flatten([
|
||||
for i in range(length(var.avere_filer_alternate_fqdn)): [
|
||||
for j in range(var.avere_ip_addr_count4):
|
||||
"local-data: \"${var.avere_filer_alternate_fqdn[i]} ${var.dns_max_ttl_seconds} A ${local.addr_prefix4}.${local.last_octet4 + j}\""
|
||||
]
|
||||
for i in range(length(var.avere_filer_alternate_fqdn)) : [
|
||||
for j in range(var.avere_ip_addr_count4) :
|
||||
"local-data: \"${var.avere_filer_alternate_fqdn[i]} ${var.dns_max_ttl_seconds} A ${local.addr_prefix4}.${local.last_octet4 + j}\""
|
||||
]
|
||||
])
|
||||
# reverse records
|
||||
local_alternate_a_records_reverse4 = var.avere_first_ip_addr4 == "" ? [] : flatten([
|
||||
for i in range(length(var.avere_filer_alternate_fqdn)): [
|
||||
for j in range(var.avere_ip_addr_count4):
|
||||
"local-data-ptr: \"${local.addr_prefix4}.${local.last_octet4 + j} ${var.dns_max_ttl_seconds} ${var.avere_filer_alternate_fqdn[i]}\""
|
||||
]
|
||||
for i in range(length(var.avere_filer_alternate_fqdn)) : [
|
||||
for j in range(var.avere_ip_addr_count4) :
|
||||
"local-data-ptr: \"${local.addr_prefix4}.${local.last_octet4 + j} ${var.dns_max_ttl_seconds} ${var.avere_filer_alternate_fqdn[i]}\""
|
||||
]
|
||||
])
|
||||
|
||||
|
||||
# join everything into the same string
|
||||
all_a_records = concat(local.local_a_records, local.local_a_records_reverse, local.local_alternate_a_records, local.local_alternate_a_records_reverse, local.local_a_records2, local.local_a_records_reverse2, local.local_alternate_a_records2, local.local_alternate_a_records_reverse2, local.local_a_records3, local.local_a_records_reverse3, local.local_alternate_a_records3, local.local_alternate_a_records_reverse3, local.local_a_records4, local.local_a_records_reverse4, local.local_alternate_a_records4, local.local_alternate_a_records_reverse4)
|
||||
all_a_records = concat(local.local_a_records, local.local_a_records_reverse, local.local_alternate_a_records, local.local_alternate_a_records_reverse, local.local_a_records2, local.local_a_records_reverse2, local.local_alternate_a_records2, local.local_alternate_a_records_reverse2, local.local_a_records3, local.local_a_records_reverse3, local.local_alternate_a_records3, local.local_alternate_a_records_reverse3, local.local_a_records4, local.local_a_records_reverse4, local.local_alternate_a_records4, local.local_alternate_a_records_reverse4)
|
||||
local_a_records_str = "local-zone: \"${var.avere_filer_fqdn}\" transparent\n ${join("\n ", local.all_a_records)}"
|
||||
|
||||
# create the dns forward lines
|
||||
dns_servers = var.dns_server == null || var.dns_server == "" ? [] : split(" ", var.dns_server)
|
||||
forward_lines = [for s in local.dns_servers : "forward-addr: ${s}"]
|
||||
dns_servers = var.dns_server == null || var.dns_server == "" ? [] : split(" ", var.dns_server)
|
||||
forward_lines = [for s in local.dns_servers : "forward-addr: ${s}"]
|
||||
foward_lines_str = join("\n ", local.forward_lines)
|
||||
|
||||
# send the script file to custom data, adding env vars
|
||||
script_file_b64 = base64gzip(replace(file("${path.module}/install.sh"),"\r",""))
|
||||
unbound_conf_file_b64 = base64gzip(replace(templatefile("${path.module}/unbound.conf", { max_ttl = var.dns_max_ttl_seconds, arecord_lines = local.local_a_records_str, forward_addr_lines = local.foward_lines_str }),"\r",""))
|
||||
cloud_init_file = templatefile("${path.module}/cloud-init.tpl", { installcmd = local.script_file_b64, unboundconf = local.unbound_conf_file_b64, ssh_port = var.ssh_port })
|
||||
script_file_b64 = base64gzip(replace(file("${path.module}/install.sh"), "\r", ""))
|
||||
unbound_conf_file_b64 = base64gzip(replace(templatefile("${path.module}/unbound.conf", { max_ttl = var.dns_max_ttl_seconds, arecord_lines = local.local_a_records_str, forward_addr_lines = local.foward_lines_str }), "\r", ""))
|
||||
cloud_init_file = templatefile("${path.module}/cloud-init.tpl", { installcmd = local.script_file_b64, unboundconf = local.unbound_conf_file_b64, ssh_port = var.ssh_port })
|
||||
|
||||
proxy_env = (var.proxy == null || var.proxy == "") ? "" : "http_proxy=${var.proxy} https_proxy=${var.proxy} no_proxy=169.254.169.254"
|
||||
}
|
||||
|
||||
data "azurerm_subnet" "vnet" {
|
||||
|
@ -111,7 +113,7 @@ data "azurerm_subnet" "vnet" {
|
|||
data "azurerm_subscription" "primary" {}
|
||||
|
||||
data "azurerm_resource_group" "vm" {
|
||||
name = var.resource_group_name
|
||||
name = var.resource_group_name
|
||||
}
|
||||
|
||||
resource "azurerm_network_interface" "vm" {
|
||||
|
@ -128,17 +130,17 @@ resource "azurerm_network_interface" "vm" {
|
|||
}
|
||||
|
||||
resource "azurerm_linux_virtual_machine" "vm" {
|
||||
name = "${var.unique_name}-vm"
|
||||
location = var.location
|
||||
resource_group_name = data.azurerm_resource_group.vm.name
|
||||
name = "${var.unique_name}-vm"
|
||||
location = var.location
|
||||
resource_group_name = data.azurerm_resource_group.vm.name
|
||||
network_interface_ids = [azurerm_network_interface.vm.id]
|
||||
computer_name = var.unique_name
|
||||
custom_data = base64encode(local.cloud_init_file)
|
||||
size = var.vm_size
|
||||
computer_name = var.unique_name
|
||||
custom_data = base64encode(local.cloud_init_file)
|
||||
size = var.vm_size
|
||||
|
||||
os_disk {
|
||||
name = "${var.unique_name}-osdisk"
|
||||
caching = "ReadWrite"
|
||||
name = "${var.unique_name}-osdisk"
|
||||
caching = "ReadWrite"
|
||||
storage_account_type = "Standard_LRS"
|
||||
}
|
||||
|
||||
|
@ -153,20 +155,20 @@ resource "azurerm_linux_virtual_machine" "vm" {
|
|||
version = "latest"
|
||||
}
|
||||
|
||||
admin_username = var.admin_username
|
||||
admin_password = (var.ssh_key_data == null || var.ssh_key_data == "") && var.admin_password != null && var.admin_password != "" ? var.admin_password : null
|
||||
admin_username = var.admin_username
|
||||
admin_password = (var.ssh_key_data == null || var.ssh_key_data == "") && var.admin_password != null && var.admin_password != "" ? var.admin_password : null
|
||||
disable_password_authentication = (var.ssh_key_data == null || var.ssh_key_data == "") && var.admin_password != null && var.admin_password != "" ? false : true
|
||||
dynamic "admin_ssh_key" {
|
||||
for_each = var.ssh_key_data == null || var.ssh_key_data == "" ? [] : [var.ssh_key_data]
|
||||
content {
|
||||
username = var.admin_username
|
||||
public_key = var.ssh_key_data
|
||||
}
|
||||
for_each = var.ssh_key_data == null || var.ssh_key_data == "" ? [] : [var.ssh_key_data]
|
||||
content {
|
||||
username = var.admin_username
|
||||
public_key = var.ssh_key_data
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resource "azurerm_virtual_machine_extension" "cse" {
|
||||
name = "${var.unique_name}-cse"
|
||||
name = "${var.unique_name}-cse"
|
||||
virtual_machine_id = azurerm_linux_virtual_machine.vm.id
|
||||
publisher = "Microsoft.Azure.Extensions"
|
||||
type = "CustomScript"
|
||||
|
@ -174,7 +176,7 @@ resource "azurerm_virtual_machine_extension" "cse" {
|
|||
|
||||
settings = <<SETTINGS
|
||||
{
|
||||
"commandToExecute": " /bin/bash /opt/install.sh"
|
||||
"commandToExecute": " ${var.proxy_env} /bin/bash /opt/install.sh"
|
||||
}
|
||||
SETTINGS
|
||||
}
|
||||
|
|
|
@ -3,17 +3,17 @@ variable "resource_group_name" {
|
|||
}
|
||||
|
||||
variable "location" {
|
||||
description = "The Azure Region into which the dnsserver will be created."
|
||||
description = "The Azure Region into which the dnsserver will be created."
|
||||
}
|
||||
|
||||
variable "admin_username" {
|
||||
description = "Admin username on the dnsserver."
|
||||
default = "azureuser"
|
||||
default = "azureuser"
|
||||
}
|
||||
|
||||
variable "admin_password" {
|
||||
description = "(optional) The password used for access to the dnsserver. If not specified, ssh_key_data needs to be set."
|
||||
default = null
|
||||
default = null
|
||||
}
|
||||
|
||||
variable "ssh_key_data" {
|
||||
|
@ -22,17 +22,17 @@ variable "ssh_key_data" {
|
|||
|
||||
variable "ssh_port" {
|
||||
description = "specifies the tcp port to use for ssh"
|
||||
default = 22
|
||||
default = 22
|
||||
}
|
||||
|
||||
variable "unique_name" {
|
||||
description = "The unique name used for the dnsserver and for resource names associated with the VM."
|
||||
default = "dnsserver"
|
||||
default = "dnsserver"
|
||||
}
|
||||
|
||||
variable "vm_size" {
|
||||
description = "Size of the VM."
|
||||
default = "Standard_D2s_v3"
|
||||
default = "Standard_D2s_v3"
|
||||
}
|
||||
|
||||
variable "virtual_network_resource_group" {
|
||||
|
@ -49,7 +49,7 @@ variable "virtual_network_subnet_name" {
|
|||
|
||||
variable "private_ip_address" {
|
||||
description = "specifies a static private ip address to use"
|
||||
default = null
|
||||
default = null
|
||||
}
|
||||
|
||||
variable "dns_server" {
|
||||
|
@ -66,32 +66,32 @@ variable "avere_ip_addr_count" {
|
|||
|
||||
variable "avere_first_ip_addr2" {
|
||||
description = "the first ip address of the Avere vserver2."
|
||||
default = ""
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "avere_ip_addr_count2" {
|
||||
description = "the count of ip addresses on the vserver2."
|
||||
default = 0
|
||||
default = 0
|
||||
}
|
||||
|
||||
variable "avere_first_ip_addr3" {
|
||||
description = "the first ip address of the Avere vserver3."
|
||||
default = ""
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "avere_ip_addr_count3" {
|
||||
description = "the count of ip addresses on the vserver3."
|
||||
default = 0
|
||||
default = 0
|
||||
}
|
||||
|
||||
variable "avere_first_ip_addr4" {
|
||||
description = "the first ip address of the Avere vserver4."
|
||||
default = ""
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "avere_ip_addr_count4" {
|
||||
description = "the count of ip addresses on the vserver4."
|
||||
default = 0
|
||||
default = 0
|
||||
}
|
||||
|
||||
variable "avere_filer_fqdn" {
|
||||
|
@ -100,10 +100,15 @@ variable "avere_filer_fqdn" {
|
|||
|
||||
variable "dns_max_ttl_seconds" {
|
||||
description = "The max ttl in seconds of the dns records, the default is 5 minutes. This will cap larger TTLS, and TTLs set lower than this value will still be respected."
|
||||
default = 300
|
||||
default = 300
|
||||
}
|
||||
|
||||
variable "avere_filer_alternate_fqdn" {
|
||||
default = []
|
||||
default = []
|
||||
description = "alternate fqdn of the avere and is useful to point other names at Avere or can be used to emulate a domain search list."
|
||||
}
|
||||
|
||||
variable "proxy" {
|
||||
description = "specify a proxy address if one exists in the format of http://PROXY_SERVER:PORT"
|
||||
default = null
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче