Terraform Bitbucket管道工件
我想用Bitbucket管道来dpeloy Terraform,一切都延伸到应用阶段。 在应用步骤中,我会遇到此错误: `
terraform apply -auto-approve output-${ENVIRONMENT}.plan
Error: Failed to load "output-development.plan" as a plan file
Error: stat output-development.plan: no such file or directory
我如何将工件转移到应用阶段,以便Bitbucket可以阅读并继续使用申请步骤?
这是我的管道 图像:Hashicorp/Terraform
definitions:
steps:
- step: &pre-deploy
name: Initilize the terraform environment
script:
- terraform init -backend-config ${ENVIRONMENT}-backend.tfvars
- terraform validate
- terraform plan -var-file=${ENVIRONMENT}.tfvars -out output-${ENVIRONMENT}.plan
artifacts:
- output-${ENVIRONMENT}.plan
- step: &terraform-apply
name: Deploy terraform code
script:
- terraform apply -auto-approve output-${ENVIRONMENT}.plan
pipelines:
branches:
develop:
- step:
<<: *pre-deploy
deployment: terraform-prepare
- step:
<<: *terraform-apply
trigger: manual
deployment: terraform-deploy
I want to dpeloy terraform with bitbucket pipelines and everything works up to the apply stage.
On apply step I'm getting this error:
`
terraform apply -auto-approve output-${ENVIRONMENT}.plan
Error: Failed to load "output-development.plan" as a plan file
Error: stat output-development.plan: no such file or directory
How can I transfer the artifact to the apply stage so bitbucket can read it and proceed with the apply step?
This is my pipeline
image: hashicorp/terraform
definitions:
steps:
- step: &pre-deploy
name: Initilize the terraform environment
script:
- terraform init -backend-config ${ENVIRONMENT}-backend.tfvars
- terraform validate
- terraform plan -var-file=${ENVIRONMENT}.tfvars -out output-${ENVIRONMENT}.plan
artifacts:
- output-${ENVIRONMENT}.plan
- step: &terraform-apply
name: Deploy terraform code
script:
- terraform apply -auto-approve output-${ENVIRONMENT}.plan
pipelines:
branches:
develop:
- step:
<<: *pre-deploy
deployment: terraform-prepare
- step:
<<: *terraform-apply
trigger: manual
deployment: terraform-deploy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论