Skip to content
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

Merged
merged 1 commit into from
Sep 5, 2017

Conversation

matevzmihalic
Copy link
Contributor

Added dedicated_host_name and dedicated_host_id options to virtual guest.

DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
_, ok := d.GetOk("dedicated_host_id")
return new == "" && ok
},
Copy link
Contributor

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?

Copy link
Contributor Author

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]
}

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@matevzmihalic
Copy link
Contributor Author

One thing I'm not sure about is if dedicated_acct_host_only and dedicated_host_* should be in conflict. Softlayer API allows you to to create VM with dedicated host id and dedicated_acct_host_only set to true or false although I think that it's logical to have only one of those set.

@athak
Copy link

athak commented Aug 29, 2017

Could #172 be related to this? Is this a relatively recent API change?

@matevzmihalic matevzmihalic force-pushed the virtual-guest-dedicated-host branch from d9677b6 to 2e1bc4f Compare August 31, 2017 08:39
@renier
Copy link
Contributor

renier commented Sep 1, 2017

@matevzmihalic To make this complete, the only thing missing is to update the docs in docs/resources/softlayer_virtual_guest.md. Thanks.

@matevzmihalic matevzmihalic force-pushed the virtual-guest-dedicated-host branch from 2e1bc4f to 909760f Compare September 4, 2017 05:49
@matevzmihalic
Copy link
Contributor Author

I added the docs.

@renier renier merged commit fad81b6 into softlayer:master Sep 5, 2017
@c4po
Copy link
Contributor

c4po commented Nov 14, 2017

@renier @matevzmihalic
This may not relate to this ticket. But I have trouble to provision vs on dedicate host. How can you get the dedicate_host_id from softlayer consul or slcli? I tried both dedicate_host_name and _id, terrform just cannot find it.

@matevzmihalic
Copy link
Contributor Author

@c4po last I checked (two months ago), the only way to create or get info about dedicated host was through web interface: docs

@matevzmihalic matevzmihalic deleted the virtual-guest-dedicated-host branch November 14, 2017 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants