This message was deleted.
# terraform-provider-rancher2
a
This message was deleted.
a
The
cluster_v2
resource is what you're after which references the machine config. The docs have examples for EC2 iirc but if you want to use vSphere here's an example I'm working on (for NSX-T) https://github.com/David-VTUK/rke2-nsxt-terraform/blob/f6dfa18951ad85235734babad363a8b6375d1e80/modules/rancher/main.tf#L5-L43 As for not using DHCP you can either use custom scripting on a per machine pool basis or use something like vapp pools: https://www.virtualthoughts.co.uk/2020/03/29/rancher-vsphere-network-protocol-profiles-and-static-ip-addresses-for-k8s-nodes/ - I wrote this for RKE1 but the same applies to RKE2.
b
Thank you. The custom script route you mentioned. Is that possible with the cloud_config parameter from your example to drive the VMware user data?
a
Yeah the cloud config references yaml that's ingested as
user-data
on first boot on the target vm
b
I see. So you could template that yaml in terraform. Although it looks like it's a yaml file per node pool so how would you give machines unique hostname and ip
a
You'd have to have a 1:1 config per node which isn't great.
Pretty much everyone I've spoken to running vSphere clusters without DHCP are using the vapp method
b
Also. Obviously no dockermachine or anything needed with rke2 but are there any other pre reqs? We can provision cluster nodes on a standard rhel 8 machine using the registration command at the moment.
a
Nothing overly specific, we've validated it against RHEL 8.5. For the e2e provisioning from Rancher you'd need cloud init installed and cleared before turning it into a template.
b
Ok cool. Stand-alone terraform is working ok with cloud init so should be good I think. 8.4 but let's see how it goes