【发布时间】:2020-04-16 08:46:40
【问题描述】:
terraform apply成功后如何运行特定的终端命令?
更具体地说,我想将输出变量保存到某个 S3 存储桶中(状态已经在 S3 中,但它包含敏感输出,因此存储桶具有受限访问权限),虽然此功能请求 is still open,但我正在使用此解决方法:
terraform apply && terraform output -json | aws s3 cp - s3://bucket/output.json
但是可以强制 terraform 自动调用这个命令吗?
【问题讨论】:
-
如何运行 Terraform?通过 CI?本地?你是使用包装脚本还是直接调用 Terraform 命令?
-
我使用普通的 CLI。本质上,我有一个
Makefile和命令terraform apply && terraform output ...用于部署目标。可以,但不优雅。它还增加了构建时间,因为当状态位于 S3 存储桶中时,terraform 输出需要相当长的时间。
标签: amazon-web-services amazon-s3 terraform