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

vsphere windows breaks due to invalid time_zone syntax #8213

Closed
ydnitin opened this issue Aug 16, 2016 · 4 comments
Closed

vsphere windows breaks due to invalid time_zone syntax #8213

ydnitin opened this issue Aug 16, 2016 · 4 comments

Comments

@ydnitin
Copy link

ydnitin commented Aug 16, 2016

Hi,

I am having trouble creating a windows VM via vsphere. apply finishes with an error (see below).

Terraform Version

Terraform v0.7.0

Affected Resource(s)

  • vsphere

Terraform Configuration Files

# Create a virtual machine
resource "vsphere_virtual_machine" "test" {
  datacenter = "Datacentre"
  name   = "xxxxxxxx"
  vcpu   = 8
  memory = 65536
  cluster = "Temp Dev"
  disk {
        datastore = "xxxxxxxx"
        template = "windows-2012-R2"
  }
  network_interface {
        label =  "xxxxxx"
        ipv4_address = "10.100.160.110"
        ipv4_prefix_length = "24"
  }

  gateway = "10.100.160.1"
  time_zone = "New Zealand Standard Time"
  domain = "xx.xxx.xx.xx"
  dns_suffixes = ["xx.xxx.xx.xx"]
  dns_servers = ["10.100.113.5"]
}

Error reported:

Error applying plan:

1 error(s) occurred:

* vsphere_virtual_machine.test: Error converting TimeZone: strconv.ParseInt: parsing "New Zealand Standard Time": invalid syntax

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

Expected Behavior

Should have ended up with a windows VM with time_zone set to New Zealand time.

Actual Behavior

Created a VM with no network adapter. Apply finished with the error above and terraform state didn't register that it created the VM. Resulting in manual deletion of the VM.
I tried without the time_zone config then it defaults to "Etc/UTC" which also produces the same error/behaviour. terraform plan indicates that it will create the same VM again "Plan: 1 to add, 0 to change, 0 to destroy."

Steps to Reproduce

  1. terraform apply

This is my first time creating windows VM with terraform. Any help is much appreciated.

@billyfoss
Copy link

I found that Windows specifies time zones via a number. I was able to get it to work using
time_zone = "085"
A full list of codes appear to be here
https://msdn.microsoft.com/en-us/library/ms912391(v=winembedded.11).aspx

@ydnitin
Copy link
Author

ydnitin commented Aug 23, 2016

thanks @billyfoss. I will try that.
It should detect windows install and set default time_zone to "085" instead of the linux format. That should prevent the broken state where terraform isn't aware that it has created a VM.

@midacts
Copy link

midacts commented Mar 29, 2018

35 worked for me for EST.
035 did not, but maybe it was because I had it in quotes (e.g. "035").
When i used time_zone = 35 it worked.

Maybe 035 would have worked if I removed the quotes

@ghost
Copy link

ghost commented Apr 4, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

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

No branches or pull requests

5 participants