【问题标题】:Terraform - Shell script permission denied error [duplicate]Terraform - Shell脚本权限被拒绝错误[重复]
【发布时间】:2021-07-20 19:40:54
【问题描述】:

我是 Terraform 世界的新手。我正在尝试使用 terraform 执行 shell 脚本。但是,我收到权限被拒绝错误。

下面是执行shell脚本的main.tf文件

#Executing shell script via Null Resource

resource "null_resource" "install_istio" {
 provisioner "local-exec" {
    command = "${path.module}/install-istio.sh"
  }
}

下面是 install-istio.sh 文件

#!/bin/sh

# Download and install the Istio istioctl client binary

# Specify the Istio version that will be leveraged throughout these instructions
ISTIO_VERSION=1.7.3

curl -sL "https://github.com/istio/istio/releases/download/$ISTIO_VERSION/istioctl-$ISTIO_VERSION-linux-amd64.tar.gz" | tar xz

sudo mv ./istioctl /usr/local/bin/istioctl
sudo chmod +x /usr/local/bin/istioctl

# Install the Istio Operator on EKS
istioctl operator init

# The Istio Operator is installed into the istio-operator namespace. Query the namespace.
kubectl get all -n istio-operator

# Install Istio components
istioctl profile dump default

# Create the istio-system namespace and deploy the Istio Operator Spec to that namespace.
kubectl create ns istio-system
kubectl apply -f istio-eks.yaml

# Validate the Istio installation
kubectl get all -n istio-system

以下是错误:

module.istio_module.null_resource.install_istio (local-exec): Executing: ["/bin/sh" "-c" ".terraform/modules/istio_module/Istio-Operator/install-istio.sh"]
module.istio_module.null_resource.install_istio (local-exec): /bin/sh: .terraform/modules/istio_module/Istio-Operator/install-istio.sh: Permission denied
module.cluster.data.aws_eks_cluster_auth.auth: Refreshing state...
Error: Error running command '.terraform/modules/istio_module/Istio-Operator/install-istio.sh': exit status 126. Output: /bin/sh: .terraform/modules/istio_module/Istio-Operator/install-istio.sh: Permission denied

有人可以帮我解决缺少的部分吗? 感谢您的所有帮助!谢谢!

【问题讨论】:

    标签: linux bash shell gitlab terraform


    【解决方案1】:

    我在命令部分添加了 chmod +x 并且它起作用了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-01-02
      • 2021-05-05
      • 1970-01-01
      • 2019-05-02
      • 1970-01-01
      • 1970-01-01
      • 2014-06-18
      相关资源
      最近更新 更多