I’m hitting the following error with the terraform module.
What am I doing wrong when passing variables? I’ve also tried surrounding the variables in double quotes
- terraform:
project_path: ‘{{ role_path }}/terraform/’
state: present
force_init: true
variables:
vsphere_username: foo
vsphere_password: bar
vsphere_server: 10.123.45.6
datacenter_name: SAN-R720
datastore_name: VMFS6_K8S_DS001
network_name: Dev Network 40.x
esxi_hosts: 10.123.45.7
resource_pool: cluster1/Resources
template_name: centos-vm-tmpl
vm_name_prefix: terra-vm
vm_num_cpus: 2
vm_memory: 1024
vm_guest_id: centos64Guest
vm_scsi_type: pvscsi
vm_ipv4_address: [“10.123.45.111”]
vm_ipv4_gateway: 10.123.45.254
vm_ipv4_netmask: 24
vm_dns_domain: my.domain.com
vm_dns_server_list: [
“10.123.45.253”,
“10.123.45.22”,
]
vm_dns_suffix_list: [
“dev.mycompany.com”,
“mycompany.com”
]
TASK [create-vms: terraform] ************************************************************************************************************************************************************
fatal: [127.0.0.1]: FAILED! => {
“changed”: false
}
MSG:
Failed to initialize Terraform modules:
Error: resource ‘data.vsphere_resource_pool.resource_pool’ config: unknown variable referenced: ‘esxi_hosts’; define it with a ‘variable’ block
Error: resource ‘data.vsphere_network.network’ config: unknown variable referenced: ‘network_name’; define it with a ‘variable’ block
Error: resource ‘vsphere_virtual_machine.vm’ count: unknown variable referenced: ‘vm_ipv4_address’; define it with a ‘variable’ block
Error: output ‘ESXi’: unknown variable referenced: ‘esxi_hosts’; define it with a ‘variable’ block