Closed luclis closed 1 month ago
I believe the intend here is to use the vsphere_host_thumbprint
thumbprint datasource, but there should be a validation for sure.
Ryan Johnson Staff II Solutions Architect | VMware, Inc.
On vSphere 7.0 Update 3 I tried hardcoding all my host's thumbprints to AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA:AA
and got the following error:
│ Error: host addition failed. Authenticity of the host's SSL certificate is not verified.
│
│ with vsphere_host.nested_esxi[0],
│ on esxi.tf line 119, in resource "vsphere_host" "nested_esxi":
│ 119: resource "vsphere_host" "nested_esxi" {
If I replace the hardcoded thumbprint with a single valid vsphere_host_thumbprint
data element then I can create ALL of the vsphere_host
s just fine - even though they don't match. This works, but probably shouldn't:
data "vsphere_host_thumbprint" "thumbprint" {
insecure = true
address = cidrhost(var.nested_esxi_cidr, 8)
}
resource "vsphere_host" "nested_esxi" {
count = var.esxi_host_count
hostname = cidrhost(var.nested_esxi_cidr, count.index + 8)
username = "root"
password = var.vsphere_password
datacenter = data.vsphere_datacenter.datacenter.id
thumbprint = data.vsphere_host_thumbprint.thumbprint.id
cluster_managed = true
}
It appears the validation is done by vSphere and not this provider.
@sneal can you send me example of the address = cidrhost(var.nested_esxi_cidr, 8) variable, i have a fix i believe but need to get that one last test done.
@burnsjared0415 are you asking what I might have used for var.nested_esxi_cidr
? If so, something like cidrhost("10.0.0.0/24", 8)
which just produces a single IP string 10.0.0.8
. In the example I had previously I was creating multiple ESXi hosts using a single resource definition via the count param.
@sneal thanks for the example let me test that use case, thanks so much
This functionality has been released in v2.9.3 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Terraform Version
vSphere Provider Version
+ provider registry.terraform.io/hashicorp/vsphere v2.0.2
vSphere Version
vSphere 7.0 Update 2
Affected Resource(s)
vsphere_host
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
The hash should be check and I shouldn't be able to import 2 esx with same hash when they have differents certificates.
Actual Behavior
I can add multiples esx with the same hash
Steps to Reproduce
Important Factoids
References
Community Note