You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
resource "vsphere_virtual_machine" "tfvm" {
for_each = {for net in data.vsphere_network.network1:net.id => net}
datastore_id = data.vsphere_datastore.datastore.id
resource_pool_id = data.vsphere_resource_pool.pool.id
name = "${var.vmname}${substr(each.value.name, -2, 2)}"
annotation = var.tfvm_annotation
folder = vsphere_folder.chefinfra.path
hv_mode = var.hv_mode
nested_hv_enabled = var.nested_hv_enabled
num_cpus = var.cpu
num_cores_per_socket = var.cpu
cpu_hot_add_enabled = true
cpu_hot_remove_enabled = true
memory = var.memory
memory_hot_add_enabled = true
guest_id = var.guest_id
scsi_type = data.vsphere_virtual_machine.template.scsi_type
wait_for_guest_net_timeout = var.guest_net_timeout
}
}
}
# =========================================================
# ADDITIONAL RESOURCES FOR JOINING INTO DOMAIN,
# CONFIGURING AND PROVISIONING WITH CHEF
# =========================================================
# =========================================================
# Allow to add Windows VM to the domain
resource "null_resource" "domain_join" {
count = "${var.VMcount}"
provisioner "file" {
source = "./vmscripts/domain-add.ps1"
destination = "c:/domain/domain-add.ps1"
#destination = "c:/chef/domain-add.ps1"
}
provisioner "remote-exec" {
inline = [
"powershell.exe -ExecutionPolicy bypass -NoLogo -NonInteractive -File c:/domain/domain-add.ps1 -AdminAccount <generic_user> -AdminPass <generic_password> > c:/domain/domain-add.ps1-log.log 2>&1"
]
}
provisioner "remote-exec" {
inline = [
"echo Scheduling reboot and stopping WinRM service so that next remote provisioner doesn't start during the shut down...",
"shutdown /r /t 0 /c \"Joined domain\"",
"net stop WinRM"
]
on_failure = "continue"
}
connection {
host = "${element(vsphere_virtual_machine.tfvm[*].default_ip_address, count.index + var.start_index)}"
type = "winrm"
user = var.tmpl_account
password = var.tmpl_passwd
}
}
Debug Output
Crash Output
Expected Behavior
What should have happened?
I removed some of my vsphere_virtual_machine configuration to reduce the amount of code in this post. Ultimately, I want all VMs to run my domain_join script.
Actual Behavior
What actually happened?
I receive an error stating that the default_IP_address attribute does not exist and therefore nothing gets passed
Steps to Reproduce
Please list the full steps required to reproduce the issue, for example:
terraform init
terraform apply
null_resource.domain_join[1]: Creating...
Error: Unsupported attribute: This object does not have an attribute named "default_ip_address".
Additional Context
Are there anything atypical about your situation that we should know? For example: is Terraform running in a wrapper script or in a CI system? Are you passing any unusual command line options or environment variables to opt-in to non-default behavior?
References
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:
This issue was originally opened by @sanzen193 as hashicorp/terraform#22489. It was migrated here as a result of the provider split. The original body of the issue is below.
Terraform Version
v0.12.6
Terraform Configuration Files
Debug Output
Crash Output
Expected Behavior
What should have happened?
I removed some of my vsphere_virtual_machine configuration to reduce the amount of code in this post. Ultimately, I want all VMs to run my domain_join script.
Actual Behavior
What actually happened?
I receive an error stating that the default_IP_address attribute does not exist and therefore nothing gets passed
Steps to Reproduce
Please list the full steps required to reproduce the issue, for example:
terraform init
terraform apply
null_resource.domain_join[1]: Creating...
Error: Unsupported attribute: This object does not have an attribute named "default_ip_address".
Additional Context
Are there anything atypical about your situation that we should know? For example: is Terraform running in a wrapper script or in a CI system? Are you passing any unusual command line options or environment variables to opt-in to non-default behavior?
References
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:
Add issue_template terraform#6017
The text was updated successfully, but these errors were encountered: