The module root has no resources
在污点上出现错误。我试图污染几个null_resources。这是代码块null_resource.provision_first
:
resource "null_resource" "provision_first" {
connection {
user = "root"
type = "ssh"
private_key = "${file("./.ssh/prv_key")}"
host = "${element(digitalocean_droplet.droplet.*.ipv4_address, count.index)}"
timeout = "2m"
}
provisioner "remote-exec" {
inline = [
# install salt-minion
"wget -O - http://bootstrap.saltstack.org | sudo sh"
]
}
provisioner "file" {
# copy minion file
source = "../salt/prod/minion"
destination = "/etc/salt/minion"
}
provisioner "file" {
# copy top.sls and init.sls files
source = "../salt/roots"
destination = "/etc/salt/roots"
}
provisioner "remote-exec" {
inline = [
# tell salt-minion to look for the state tree in
# the local file system, with the --local flag.
"salt-call --local state.highstate -l debug"
]
}
}
这是代码块null_resource.provision_last
:
resource "null_resource" "provision_last" {
connection {
user = "root"
type = "ssh"
private_key = "${file("./.ssh/prv_key")}"
host = "${element(digitalocean_droplet.droplet.*.ipv4_address, count.index)}"
timeout = "2m"
}
provisioner "file" {
source = "../site/index.html"
destination = "/usr/nginx/html/site/index.html"
}
provisioner "file" {
source = "../site/assets"
destination = "/usr/nginx/site"
}
provisioner "remote-exec" {
inline = [
"mv /usr/nginx/html/site/build/index.html /usr/nginx/html/site/index.html"
]
}
}
我无法弄清楚我做错了什么。据我所知,它应该能够污染这些资源中的每一个。这就是我在命令行上所做的:terraform taint null_resource.provision_last
和terraform taint null_resource.provision_first
我的命令中缺少模块路径。更多细节在这里。
这是正确的写法:
例如,如果我的模块名为
hosting
:如果我想污染以下资源:
我需要执行以下操作: