【发布时间】:2020-02-07 19:17:32
【问题描述】:
我正在编写一个 teamcity 管道,在该管道中我使用 terraform 来启动一些 AWS 实例。 我的管道使用 docker 来一一调用所有步骤
但是,terraform init 不断失败并显示 terraform: Command not found error
[11:05:00][Step 2/6] Initialising terraform
[11:05:00][Step 2/6] terraform init
[11:05:00][Step 2/6] Makefile:41: recipe for target 'terraformApply' failed
[11:05:00][Step 2/6] make: terraform: Command not found
这是我的 Makefile 的 terraformApply sn-p
@echo Download terraform
# ${CURDIR}
wget https://releases.hashicorp.com/terraform/0.12.20/terraform_0.12.20_linux_amd64.zip
unzip -o terraform_0.12.20_linux_amd64.zip
@echo Terraform downloaded
# @echo Current Directory
# ${CURDIR}
sleep 60
@echo *
@echo Initialising terraform
terraform init
## sudo terraform/terraform plan
@echo Terraform initialised
TF_VAR_AWS_ACCESS_KEY="****" TF_VAR_AWS_SECRET_KEY="****" terraform apply -auto-approve
@echo Terraform setup done
我的管道在 linux 代理上运行。
我直接在 linux 机器上运行了这个 Makefile,效果很好。然而,在 teamcity 管道上,它找不到提取的 terraform。
此外,在 Makefile 中使用 echo * 列出目录中存在的所有文件,我确实看到 terraform 存在于同一路径中。
任何帮助将不胜感激。
【问题讨论】:
标签: docker makefile teamcity terraform