Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform default_IP_address v0.12.6 #823

Closed
ghost opened this issue Aug 16, 2019 · 1 comment
Closed

Terraform default_IP_address v0.12.6 #823

ghost opened this issue Aug 16, 2019 · 1 comment
Labels
bug Type: Bug

Comments

@ghost
Copy link

ghost commented Aug 16, 2019

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


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:

  1. terraform init
  2. 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:

@teamterraform
Copy link

Closing as a core issue.

@ghost ghost locked and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Type: Bug
Projects
None yet
Development

No branches or pull requests

2 participants