在vRA中创建Windows计算机时,Terraform将在获取新计算机的IP / FQDN并传递到资源调配器之前,移至Chef Provisioner块。
Terraform v0.11.14 + provider.vra7 v0.2.0
我已经尝试了一切可以从互联网上获得的东西;使用caly_on属性,设置睡眠计时器,使loca-exec's刀启动,似乎无济于事。
resource "vra7_deployment" "terraform-1" {
count = "${var.server_count}"
description = "deployment via terraform"
reasons = "because it's awesome"
catalog_item_name = "${var.vra_cat_item_name}"
wait_timeout = "1800"
provisioner "chef" {
# This is for chef_server to talk to the node
connection {
type = "winrm"
user = "${var.KT_USER}"
password = "${var.KT_PASS}"
insecure = true
}
# This is for TF to talk to the chef_server
server_url = "${var.chef_server_url}"
node_name = "terraform-chef-test"
run_list = [ ]
user_name = "${var.chef_user_name}"
user_key = "${file(var.chef_user_pem)}"
recreate_client = true
fetch_chef_certificates = true
environment = "_default"
ssl_verify_mode = false
version = "12"
}
}
错误:
vra7_deployment.terraform-1: Still creating... (21m20s elapsed)
vra7_deployment.terraform-1 (chef): Connecting to remote host via WinRM...
vra7_deployment.terraform-1 (chef): Host:
vra7_deployment.terraform-1 (chef): Port: 5985
vra7_deployment.terraform-1 (chef): User: engineering
vra7_deployment.terraform-1 (chef): Password: true
vra7_deployment.terraform-1 (chef): HTTPS: false
vra7_deployment.terraform-1 (chef): Insecure: true
vra7_deployment.terraform-1 (chef): NTLM: false
vra7_deployment.terraform-1 (chef): CACert: false
* vra7_deployment.terraform-1: interrupted - last error: unknown error Post http://:5985/wsman: dial tcp :5985: connectex: No connection could be made because the target machine actively refused it.
答案 0 :(得分:0)
var.chef_server_url
是一个地形变量,不是vra7_deployment.terraform-1
的输出。
如果未设置var.chef_server_url
且没有任何值将其传递给供应商,则供应商连接将无法工作
答案 1 :(得分:0)
我知道了。关键是要了解我的vRA实例已设置好,因此VM称为vSphere_Machine_1
。它以Component Name
的形式出现在用户界面中。
肯定有一些精神上的飞跃,我敢肯定我必须看过所有其他例子,并犯下所有的错误才能使我的大脑在那时融合在一起。无论采用哪种机制,此代码现在都起作用:
# in resource block
resource_configuration {
vSphere_Machine_1.name = ""
}
...
# in provisioner block
connection {
host = "${self.resource_configuration.vSphere_Machine_1.name}"
....
}
现在,当然,在下一个砖墙上...但是我想通了。我打算将其转发给社区。 p>