-
Notifications
You must be signed in to change notification settings - Fork 112
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
Add placement policy to vcd_vapp_vm and vcd_vm resources and data sources #922
Add placement policy to vcd_vapp_vm and vcd_vm resources and data sources #922
Conversation
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
…ider-vcd into add-placement-policy-to-vm Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
@adambarreiro, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
1 similar comment
@adambarreiro, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding
|
…ider-vcd into add-placement-policy-to-vm Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
…ider-vcd into add-placement-policy-to-vm Signed-off-by: abarreiro <[email protected]>
b426499
to
1e1ea5e
Compare
Signed-off-by: abarreiro <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be good as long as the tests pass.
Signed-off-by: abarreiro <[email protected]>
Signed-off-by: abarreiro <[email protected]>
Description
This PR:
The proposed changes onboard the new attribute placement_policy_id to
vcd_vapp_vm
andvcd_vm
resource and data source. This attribute complements sizing_policy_id: It assigns the referenced VM Placement Policy to the specified VM.This VM Placement Policy can be assigned, updated or removed, although it can be removed only if the VM has already a VM Sizing Policy, as the VM must have either a VM Sizing Policy or a VM Placement Policy (if the VDC has any assigned, of course). If one tries to remove both, operation should fail.
Both VM Sizing Policy and VM Placement Policy need to be updated in the same API call, as both are "VDC Compute Policies". Otherwise, one or another would get unassigned from the VM.
Use cases
The state should populate either
sizing_policy_id
orplacement_policy_id
with the Compute Policy ID.should give this error:
Issues
In the original code,
sizing_policy_id
was Computed and Optional. To preserve compatibility, this didn't change, but adds some complexity/quirks to the way that the combination of sizing_policy_id + placement_policy_id work. The main problem is that sizing_policy_id does not trigger an Update if one puts the following snippets and nothing else changed in config:In the Refresh stage, Terraform will say that the state matches the configuration, unless we put:
In the code we explicitly trim the spaces so this should be good. I didn't find any way to force an Update when one tries to explicitly set an empty value to this attribute. Terraform simply ignores it during Refresh, as if you didn't specify anything at all.
Also this is not really a big deal as this situation (trying to remove the sizing policy when there is not a placement policy and nothing else changed in config) should always trigger an error (at least one policy is required, if the VDC has assigned policies). So unless someone wants to make the Apply fail, she should never face this scenario.
In versions <= v3.7.0 this was not an issue because we did not support VM Placement Policies, so one could not (and should not) remove the VM Sizing Policy once set. Now, with VM Placement Policies, one can remove the Sizing Policy.
Tests
sizing_policy_id = " "
. It should error as it needs at least one policy.