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

Hardcoded timeout causes VM build to fail #250

Closed
gfenn-newbury opened this issue Feb 4, 2021 · 3 comments
Closed

Hardcoded timeout causes VM build to fail #250

gfenn-newbury opened this issue Feb 4, 2021 · 3 comments
Labels

Comments

@gfenn-newbury
Copy link
Contributor

gfenn-newbury commented Feb 4, 2021

Nutanix Cluster Information

Please provide the version of:

  • Nutanix Cluster (Prism Element / AOS): 5.18.1.2
  • Nutanix Prism Central: 2020.9.0.1
  • Provider Version: 1.2.0

Terraform Version

0.14.4

Affected Resource(s)

  • nutanix_virtual_machine

Expected Behavior

VM built after running remote-execs, which can take over 1 minute

Actual Behavior

Error: error waiting for vm (18dee129-8b0d-4292-8304-9bdb14ebfaa7) to create: timeout while waiting for state to become 'SUCCEEDED' (last state: 'RUNNING', timeout: 1m0s)
  on .terraform/modules/test_vm/nutanix.tf line 11, in resource "nutanix_virtual_machine" "vm":
  11: resource "nutanix_virtual_machine" "vm" {

Steps to Reproduce

Build VM on 1.2.0 which takes longer than 1 minute to build

This bug is cause by the following hard-coded timeouts with the nutanix_virtual_machine resource:

https://github.com/nutanix/terraform-provider-nutanix/blob/master/nutanix/resource_nutanix_virtual_machine.go#L21-L27

https://github.com/nutanix/terraform-provider-nutanix/blob/master/nutanix/resource_nutanix_virtual_machine.go#L884-L895

Edit 2020-02-05: Not caused by the above code

This causes a VM to fail its build if it continues for longer than 1 minute. There is no way to override this timeout Timeout can be overridden using wait_timeout in the provider block. However, this sets the timeout globally for the provider on all resources and all actions, and doesn't use Hashicorp's documented method allowing a timeout block for individual resources.

The pull request which caused this issue is: #101

gfenn-newbury pushed a commit to gfenn-newbury/terraform-provider-nutanix that referenced this issue Feb 4, 2021
@gabybeitler
Copy link
Contributor

There is a wait_timeout parameter in the provider. Could you use that parameter in your TF code and see if that accomplished what you need? An example is below.

provider "nutanix" {
wait_timeout = 2
insecure = true
port = 9440
}

@gfenn-newbury
Copy link
Contributor Author

gfenn-newbury commented Feb 5, 2021

Thanks, I'll give it a try and report back. I assume wait_timeout is in minutes?

Is there any documentation to what the default value is, and why this was suddenly enforced with v1.2.0 (can't find any mention of timeouts in the changelog)? Seems the code I linked to above was included in v1.1.0 and v1.1.1, so it's not the cause. However, rolling back to v1.1.1 allows builds to take more than 1 minute without needing to specify wait_timeout, so something has changed between v1.1.1 and v1.2.0 which enforces the timeout.

We did try to use a timeouts block within the resource itself as documented by hashicorp, but apparently using the block is unsupported with the Nutanix provider. Would it be possible to use this method, rather than specify a global wait_timeout in the provider? We would ideally not want to use wait_timeout to avoid having the same timeout set for creating a nutanix_subnet (which should take only a minute or two) as we would for a nutanix_virtual_machine (which in our case takes in excess of 30 minutes with all remote-exec provisioners).

Lastly, what's the rationale for having the timeout so low? It probably works in the use case of creating a new VM without using any provisioners, but as soon as you add provisioners to the VM (for example, to kick off configuration management tools such as Ansible or Puppet), it can easily take longer than 1 minute.

@gfenn-newbury
Copy link
Contributor Author

Can confirm setting wait_timeout = 60 allows us to get past the 1 minute mark. Thank you for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants