-
Notifications
You must be signed in to change notification settings - Fork 26
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 dedicated host option to virtual guest #170
Conversation
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { | ||
_, ok := d.GetOk("dedicated_host_id") | ||
return new == "" && ok | ||
}, |
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.
Is this func necessary even with the conflictsWith?
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.
Yes it is needed. Because when you create VM terraforms saves dedicated_host_name
and dedicated_host_id
to tfstate
. Then if you apply it again it gets empty string for dedicated_host_name
from *.tf
file and actual name from tfstate
.
Without this function terraform recreates VM every time.
|
||
opts.DedicatedHost = &hosts[0] | ||
} | ||
|
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.
given the restrictions in the schema, shouldn't these 3 if clauses be chained in else-if?
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.
Because only one of those 3 options can be set each time we don't actually need chained if-else, but I can do it like that if you think it will make the code more readable.
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.
Yes, I think it would make it more explicit as to the mutual exclusivity we are trying to enforce for those options.
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.
Fixed.
One thing I'm not sure about is if |
Could #172 be related to this? Is this a relatively recent API change? |
d9677b6
to
2e1bc4f
Compare
@matevzmihalic To make this complete, the only thing missing is to update the docs in |
2e1bc4f
to
909760f
Compare
I added the docs. |
@renier @matevzmihalic |
Added
dedicated_host_name
anddedicated_host_id
options to virtual guest.