Hi,
I’m getting this error while running terraform plan :
Such as my currrent version of terraform is 0.14.8:
2021-04-07T14:25:33.8322384Z Error: Reference to undeclared input variable
2021-04-07T14:25:33.8322880Z
2021-04-07T14:25:33.8323517Z on main.tf line 21, in module "az-citrix-netscaler":
2021-04-07T14:25:33.8324286Z 21: for_each = var.vm-netscaler
2021-04-07T14:25:33.8324620Z
2021-04-07T14:25:33.8325191Z An input variable with the name "vm-netscaler" has not been declared. This
2021-04-07T14:25:33.8326352Z variable can be declared with a variable "vm-netscaler" {} block.
variables.tf
variable "vm-netscaler" {
type = map(any)
default = {
netscaler1 = {
instance = "007"
private_ip_address = "10.255.35.131"
computer_name = "shsprdcomvm007"
zones = ["2"]
}
netscaler2 = {
instance = "008"
private_ip_address = "10.255.35.132"
computer_name = "shsprdcomvm008"
zones = ["3"]
}
}
}
variable "admin_username" {
type = string
description = "The name of the local administrator account"
}
variable "admin_password" {
type = string
description = "The password associated with the local administrator account"
}
variable "m_image_publisher" {
type = string
description = "Publisher of the VM image"
default = "citrix"
}
variable "m_image_offer" {
type = string
description = "Specifies the offer of the image used to create the virtual machine"
default = "netscalervpx121"
}
variable "m_image_sku" {
type = string
description = "The SKU of the image used to create the virtual machine."
default = "netscalerbyol"
}
variable "m_image_version" {
type = string
description = "The version of the image used to create the virtual machine"
default = "latest"
}
main.tf
module "az-citrix-netscaler" {
source = "git::https://.."
for_each = var.vm-netscaler
m_environment = var.environment
m_domain_name = var.domain_name
m_common_tag = local.common_tag
m_resource_group_name = local.current_rg
m_subnet_name = var.subnet_name
m_vnet_name = var.vnet_name
m_vnet_resource_group = var.vnet_resource_group
m_ip_config_name = "ifconfig"
m_private_ip_allocation = "Static"
m_vm_size = var.vm_size
m_os_disk_size_gb = 128
m_add_default_data_disk = false
m_boot_diagnostics_isrequired = false
m_diagnosticsext_isrequired = false
m_tag_vm_function = "Citrix-Netscaler"
m_mda_isrequired = false
m_mma_isrequired = false
m_disk_initialize_isrequired = false
m_instance = each.value.instance
m_private_ip_address = each.value.private_ip_address
m_computer_name = each.value.computer_name
m_admin_username = var.admin_username
m_admin_password = var.admin_password
m_zones = each.value.zones
}
Could you please support me thx