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

Is there a way to bring in new vSphere_Host resources? #570

Closed
ScriptXaaS opened this issue Jul 20, 2018 · 10 comments
Closed

Is there a way to bring in new vSphere_Host resources? #570

ScriptXaaS opened this issue Jul 20, 2018 · 10 comments
Labels
enhancement Type: Enhancement new-resource Feature: New Resource

Comments

@ScriptXaaS
Copy link

I would like to add all esxi hosts to vCenter to create a cluster. however, I don't see a way to bring in new esxi hosts as vSphere_Host resources? If the feature is not yet available, I will bring these in via a powercli script. I am building a new vSphere Infrastructure from scratch and would like automate the build as much with terraform to the lowest level including vmknic creations if possbile. Thanks.

@bill-rich
Copy link
Contributor

Hi @ScriptXaaS! There is not a vsphere_host resource yet, but it is one I am hoping to get to in the near future. As far as the configuration options, I'm not certain exactly what level of control will be available for the host resource initially. It will depend on several factors. For example, managing vmknics could be tricky if there is a need to migrate interfaces when the host is added.

For now, you would need to add the ESXi hosts using another method, and once they are in vCenter, you can then use the vsphere_host data source to add them to a cluster.

I'll leave this issue open to keep track of the request for the vsphere_host resource.

@ScriptXaaS
Copy link
Author

Hi @bill-rich,
Initially even if a vsphere_host resource could just be there to bring in to vCenter at the vCenter level, that would be great as vmknics could always be manipulated with API or powercli via a provisioner. Without terrafom provisioning the vsphere_host resources, if I have to use powercli to bring in the ESXi hosts; I have to do in two different tf's, as data source cannot discover the vsphere_host that will be added via a provisioner. I look forward to this feature that I may be a step closer to automate the vsphere infrastructure end-to-end build from scratch. Thanks.

@paddycarver paddycarver added enhancement Type: Enhancement new-resource Feature: New Resource labels Aug 1, 2018
@jones-g
Copy link

jones-g commented Aug 27, 2018

+1 for this feature. Would rock to be able to configure host into vCenter directly. I could live without vmknic configuration, primarily interested in pulling host into vCenter in a specific folder or cluster and adding/changing vSwitch and port group settings before deploying VMs.

@kiwiscott
Copy link

We have added this into a fork that we are using. We're currently deciding on the correct path forward. There's three things that we really struggle with:

  • Testing the code needs to be simpler. We should be able to test against a simple vcenter with one host (the smallest possible footprint). Our testing of vm's and clusters conflates the problem. Without testing I can't see how we can really confidently change the code.

-This provider isn't single responsibility. The 'creation of a VM' and the 'configuration of the hosts and clusters' are two different things. I too want to manipulate hosts but I'm wondering it that should be a separate provider / or if this provider should be split.

  • The current version of the vendored imports is old meaning fixes / changes to govmomi are not imported. We've got functionality that we need to add into govmomi as well which inturn will then mean we need to update and then merge this repo. Perhaps we should upgrade to go 1.11 and user the new modules support to fix our vendoring to specific versions.

@bill-rich
Copy link
Contributor

Thats great you have been working on this feature @kiwiscott!

To your testing issue, you can specify which acceptance tests you would like to run by including -run= in your TESTARGS. For example, to only run the TestAccResourceVSphereVirtualMachine_basic test, you could run:

make testacc TEST=github.com/terraform-providers/terraform-provider-vsphere/vsphere TESTARGS="-count=1 -run=TestAccResourceVSphereVirtualMachine_basic"

The run arg is a regular expression, so if you wanted to run all VSphereVirtualMachine tests, you would use -run=TestAccResourceVSphereVirtualMachine

On the issue of splitting the provider, it is a good point. The vsphere provider does have to tackle a wider breadth of issues since the expectation is to treat vSphere like a cloud, but it really is not. I see how a split could result in providers with a more specific focus, however I feel that the crossover between the two would result in a lot of duplicated work and drift.

For the final point, I haven't looked too closely at how the 1.11 module support could be utilized for improving the imports and the effects it would have on the current code. I'd like to take a more in depth look at this and get some feedback on it, but I think it would be best to create a new issue so it can be tracked independently of this one.

If you have code for the vsphere_host resource that you'd like to get into the provider, please submit a PR. Community contributions are always welcome!

@bcornils bcornils added this to the v1.10.0 milestone Feb 6, 2019
@jones-g
Copy link

jones-g commented May 24, 2019

How's it looking getting this implemented? Can see it as having been scheduled for 1.10 but with 1.11 released an no mention I assume it was skipped. I would love to see the option to completely configure clusters with terraform instead of relying on Host Profiles.

@kiwiscott
Copy link

kiwiscott commented May 24, 2019 via email

@bill-rich
Copy link
Contributor

@jones-g Sorry about the confusion on that. Originally the plan was to put host resources into 1.10 or v1.11, but we had to shift focus toward some other issues and Terraform 0.12 support. It is still high on the backlog, but not ready to release yet.

@jones-g
Copy link

jones-g commented May 27, 2019

@bill-rich @kiwiscott That's cool guys. Was just wondering what the status was. From the updates on 0.12 I could understand some major changes were made.

I'll keep an eye out for an update :) Thanks for working on this guys!

@aareet aareet modified the milestone: v1.10.0 Oct 4, 2019
@bill-rich
Copy link
Contributor

Hey All! Host resources were implemented in #836, and has been released in v1.13.0 of the provider. If you have any questions or feature requests regarding the new host resource, please feel free to open a new issue.

@ghost ghost locked and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Type: Enhancement new-resource Feature: New Resource
Projects
None yet
Development

No branches or pull requests

7 participants