[英](AWS Opsworks) Terraform Chef provisioning: ERROR: Failed to authenticate
New to Terraform and I am trying to bootstrap a node to chef after the instance is created. Terraform的新手,我正在尝试在创建实例后将节点引导至Chef。
Here is the file: 这是文件:
resource "aws_instance" "jenkinsNode" {
provisioner "remote-exec" {
connection {
user = "ubuntu"
private_key = "${file("~/key/mykey.pem")}"
host = "${aws_instance.jenkinsNode.public_ip}"
}
inline = [
"sudo mkdir -p /etc/chef/trusted_certs",
"sudo curl --silent --show-error --retry 3 --location --output
\"/etc/chef/trusted_certs/opsworks-cm-ca-2016-root.pem\"
\"https://opsworks-cm-us-assets.s3.amazonaws.com/misc/opsworks-cm-ca-2016-root.pem\""
]
}
provisioner "chef" {
environment = "_default"
run_list = ["android-aws-nodes::updateAndroidSdk"]
node_name = "jenkinsNodeOnDemandUpdate"
secret_key = "${file("~/chef/mobile-chef-aws/.chef/private.pem")}"
server_url = "https://my-opsworks-server.io/organizations/default"
recreate_client = true
user_name = "delivery"
user_key = "${file("~/chef/mobile-chef-aws/.chef/private.pem")}"
version = "12.8.1"
}
connection {
user = "ubuntu"
private_key = "${file("~/key/jenkins-main.pem")}"
}
count = 1
instance_type = "c4.8xlarge"
ami = "ami-0000000"
key_name = "mykey"
subnet_id = "subnet-00000000"
vpc_security_group_ids = ["sg-00000000"]
}
I am receiving the following error when I run when I try to apply the above code. 尝试应用以上代码时,我在运行时收到以下错误。 I connected and starts the bootstrap process but it keeps complaining that it can't find the private (Which I believe is created when run the "client create". I ssh'd into the instance and I do not see the ubuntu.pem in the /etc/chef/ directory:
我连接并启动了引导过程,但始终抱怨它找不到私有(我相信这是在运行“客户端创建”时创建的。我进入了该实例,但看不到ubuntu.pem / etc / chef /目录:
UPDATED aws_instance.jenkinsNode (chef): ERROR: Failed to authenticate to https://mobile-b9oer25dyrts1qor.us-east-1.opsworks-cm.io/organizations/default/ as delivery with key /etc/chef/delivery.pem aws_instance.jenkinsNode (chef): Response: Invalid signature for user or client 'delivery' aws_instance.jenkinsNode (chef): Cleanup user key... 更新的aws_instance.jenkinsNode(chef):错误:无法通过密钥/etc/chef/delivery.pem进行身份验证到https://mobile-b9oer25dyrts1qor.us-east-1.opsworks-cm.io/organizations/default/作为交付aws_instance.jenkinsNode(chef):响应:用户或客户端“传递”的无效签名aws_instance.jenkinsNode(chef):清理用户密钥...
Error applying plan:
1 error(s) occurred:
* aws_instance.jenkinsNode: 1 error(s) occurred:
* Command "sudo knife client create jenkinsNodeOnDemandUpdate -d -f /etc/chef/client.pem -c /etc/chef/client.rb -u ubuntu --key /etc/chef/ubuntu.pem" exited with non-zero exit status: 100
There is no key when you log in, because it is removed right after failed bootstrap 登录时没有密钥,因为引导失败后会立即将其删除
aws_instance.jenkinsNode (chef): Cleanup user key...
Double check if key ( ~/key/mykey.pem
) on machine which runs Terraform is in proper format. 仔细检查运行Terraform的计算机上的密钥(
~/key/mykey.pem
)是否格式正确。 Also it should be loaded with $file
or put as String: 另外,它应该加载
$file
或作为String放置:
user_key = "${file("~/key/mykey.pem")}"
Just double check if Terraform supports ~
. 只需仔细检查Terraform是否支持
~
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.