Remove size attribute for attached disks #528
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current Problem
When creating a disk resource and attaching it to a VM resource the
terraform apply
operation shows this plan below (notice the size set to zero):If the VM resource is then tainted to force a replacement using
terraform taint
the plan is then displayed as below (notice no size attribute present)This goes on to fail with an error
Mismatch reason: extra attributes: disk.2.size
producing an output with two sectionsDiff One (usually from plan):
andDiff Two (usually from apply):
. Comparing the two shows thatDiff Two (usually from apply):
contains this extra part:This happens when running with
Terraform Version: 0.11.7
andprovider.vsphere = 1.5.0
My Fix
Since both the documentation and the code itself mention that when attaching a disk the
size
attribute can't be used, I force that attribute to be removed if it is set and the operation is attach.Destroying everything and starting fresh with the fix applied results in the below (No size is set):
And then tainting the VM and running the apply again results in the below (No size is set).
And this time the VM replacement finishes without errors and the disk is reattached correctly.