AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 769499
Accepted
nunop
nunop
Asked: 2016-04-12 06:08:46 +0800 CST2016-04-12 06:08:46 +0800 CST 2016-04-12 06:08:46 +0800 CST

Terraform,在污点上出现“模块根目录没有资源”错误

  • 772

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

terraform
  • 1 1 个回答
  • 3430 Views

1 个回答

  • Voted
  1. Best Answer
    nunop
    2016-04-12T15:20:00+08:002016-04-12T15:20:00+08:00

    我的命令中缺少模块路径。更多细节在这里。

    这是正确的写法:

    terraform taint -module=MODULENAME TYPE.NAME
    

    例如,如果我的模块名为hosting:

    module "hosting" {
        ...
    }
    

    如果我想污染以下资源:

    resource "null_resource" "provision_last" {
        ...
    }
    

    我需要执行以下操作:

    terraform taint -module=hosting null_resource.provision_last
    
    • 7

相关问题

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve