-
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 support for all Guest Customization options in resource and data source vcd_vapp_vm
#462
Conversation
* `enabled` (Optional; *v2.7+*) `true` will enable guest customization which may occur on first boot or if the `force` flag is used. | ||
This option should be selected for **Power on and Force re-customization to work**. For backwards compatibility it is | ||
enabled by default when deprecated field `initscript` is used. | ||
* `change_sid` (Optional; *v2.7+*) Allows to change SID (security identifier). Only applicable for Windows operating systems. |
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.
Only applicable for Windows operating systems.
This is a useful comment. Are there more options below which should have it too?
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.
The customization is pretty much "mystified". Many of the fields may work or not work properly based on the guest operating system. What I did find is that change_sid
is mentioned exclusively in vCD documentation - https://docs.vmware.com/en/vCloud-Director/9.7/com.vmware.vcloud.user.doc/GUID-BB682E4D-DCD7-4936-A665-0B0FBD6F0EB5.html
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.
One small doc polish, nice otherwise!
website/docs/r/vapp_vm.html.markdown
Outdated
* `join_domain_user` (Optional; *v2.7+*) User to be used for domain join. | ||
* `join_domain_password` (Optional; *v2.7+*) Password to be used for domain join. | ||
* `join_domain_account_ou` (Optional; *v2.7+*) Organizational unit to be used for domain join. | ||
* `initscript` (Optional; *v2.7+*) Provide initscript to be executed when customization is applied. | ||
|
||
## Example forced customization workflow |
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.
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.
Changed from //
to #
(the real HCL comment symbol).
vcd/resource_vcd_vapp_vm.go
Outdated
if len(customizationSlice) == 1 { | ||
cust := customizationSlice[0] | ||
if cust != nil { | ||
// customBlock := cust.(map[string]interface{}) |
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.
do we still need this comment?
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.
Nope. removed.
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.
Overall looks straight forward
vcd/resource_vcd_vapp_vm.go
Outdated
// Only react to "enabled" field when legacy `initscript` is not specified. Legacy behavior is such that when `initscript` | ||
// is specified - guest customization is enabled by default therefore we ignore "enabled" field | ||
if _, isSetDeprecatedInitScript := d.GetOk("initscript"); !isSetDeprecatedInitScript { | ||
// if enabled, isEnabled := customBlock["enabled"]; isEnabled { |
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.
do we still need this comment?
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.
Nope. removed.
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.
Run on 9.5 looks good. LGTM
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.
LGTM
Closes #303, closes #52, closes #427
This PR adds support for all Guest customization options available in the UI and adds the following fields to
customization
block:initscript
is deprecated and moved tocustomization
block to reflect UI behavior and API position)All the above fields are computed and optional. This means that there are no breaking changes. User is free to set only some of the fields and the others will not be overridden as they may be coming from catalog item itself.
Note it is pretty much hard to cover behavior in tests because majority of these fields require a Windows machine, which is too big to include into testing routine.
Bugs covered in this PR:
resource/vcd_vapp_vm
when a single value of customization.0.force=false was specified in thecustomization
block - it would crash with interface {} is nil error (was previously raised as a separate PR https://github.com/terraform-providers/terraform-provider-vcd/pull/456, but because it was not merged and these PRs go over each other I have closed that one)resource/vcd_vapp_vm
customization.0.force=true
could have skipped "Forced customization" on each applyExtra features:
make test-upgrade-prepare
with similar behavior tomake test-binary-prepare
to only generate files and not trigger test run itselfTests have passed on the following: