Terraform local-exec provisioner on an EC2 instance fails with “Permission denied”

前端 未结 1 1968
孤街浪徒
孤街浪徒 2021-01-24 09:43

Trying to provision EKS cluster with Terraform.

terraform apply fails with:

module.eks_node.null_resource.export_rendered_template: Provisio         


        
1条回答
  •  时光说笑
    2021-01-24 10:19

    The local-exec provisioner is running the cat command on your local system (the one running Terraform) to output the contents of the user-data script, presumably for later reference. However, your user running Terraform does not have permission to write to the / directory.

    If you don't care about having the rendered user-data script output to a local file, then you can comment out the whole resource "null_resource" "export_rendered_template" block.

    But if you do want it, try changing the output path from /data-output.sh to ./data-output.sh or some other path where your user can write to.

    Note: This may not work cleanly on Windows as you may need to change paths.

    0 讨论(0)
提交回复
热议问题