Jen*_*fer 2 terraform terraform0.12+
目前我正在 shell 命令下运行
@if [ -x "$$(command -v terraform)" ]; then \
echo "==> Checking terraform formatting of files"; \
(terraform validate ./test && echo "Terraform format check passed successfully") \
|| (echo "validation failed" && exit 1); \
else \
echo "No terraform command found"; \
exit 1; \
fi
Run Code Online (Sandbox Code Playgroud)
在这里我不想初始化后端,但它似乎这样做了,我也看到错误为
? on test/policy.tf line 320:
? 320: module "service_admin_policy" {
?
? This module is not yet installed. Run "terraform init" to install all
? modules required by this configuration.
terraform version = 1.1.6
Run Code Online (Sandbox Code Playgroud)
使用 terraform validate 我只想检查目录中的 .tf 文件在语法上是否正确,例如缺少大括号和逗号之类的东西。有关如何忽略这些错误的任何帮助。
验证的工作原理是检查代码的健全性,包括加载模块并确保变量命名正确。
如果您只需要本地文件的基本语法,请考虑使用terraform fmt -write=false. 如果格式化程序无法解析该文件,则会抛出错误。
| 归档时间: |
|
| 查看次数: |
4462 次 |
| 最近记录: |