如何解决在 Google Cloud Build 中运行 Terraform
我想向 Cloud Build 提交构建以运行 Terraform 命令来创建 GKE 集群。我关注过 this 和 this 之类的帖子。我尝试使用 dir
和 volume
设置后端,但没有任何效果。所有构建都像这样失败:
Starting Step #1
Step #1: Already have image: hashicorp/terraform:0.14.2
Step #1:
Step #1: Error: No configuration files
Step #1:
Step #1: Apply requires configuration to be present. Applying without a configuration
Step #1: would mark everything for destruction,which is normally not what is desired.
Step #1: If you would like to destroy everything,run 'terraform destroy' instead.
Step #1:
Finished Step #1
ERROR
ERROR: build step 1 "hashicorp/terraform:0.14.2" failed: step exited with non-zero status: 1
这是后端:
terraform {
backend "gcs" {
bucket = "<BUCKET_NAME>"
}
}
这是 YAML:
steps:
- name: 'hashicorp/terraform:0.14.2'
args: ['init']
- name: 'hashicorp/terraform:0.14.2'
args: ['apply','-var=PROJECT_ID=$PROJECT_ID','-auto-approve']
我需要在 YAML 中进行哪些更改才能让 Terraform 通过 Cloud Build 成功运行?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。