vultr / terraform-provider-vultr-community

Terraform Vultr provider
Mozilla Public License 2.0
50 stars 7 forks source link

[BUG] - Impossible to `apply` after creating server from snapshot #96

Closed OJFord closed 5 years ago

OJFord commented 5 years ago

Describe the bug If a server is created from snapshot, subsequent refreshes read the os_id as the underlying OS in the snapshot, not the special meaning 164 (see #95 for more info), which means that a change is always detected:

      ~ os_id             = 244 -> 164
[...]
      snapshot_id       = "<checksum>"

where 244 is the underlying OS (Debian in this case) in the snapshot.

It's not good terraform practice to have spurious 'changes' like this, but it's worse in this case, since it actually prevents us from applying:

Error: Error occured while updating os_id for server <N> : Invalid operating system.

i.e. we cannot update in-place (and we certainly don't want to re-create every time!) to the special os_id = 164.

To Reproduce Steps to reproduce the behavior:

  1. Create a vultr_server resource with os_id = 164 and valid snapshot_id
  2. terraform apply, wait for success
  3. terraform plan, note the planned 'change'
  4. terraform apply, note the failure

Expected behavior terraform plan in reproduction step 3 should show no change.

ddymko commented 5 years ago

@OJFord

Thanks for catching this. This looks like one off behavior with our V1 API implementation which is causing issues. We are looking into addressing this issue.