【发布时间】:2021-07-15 07:43:37
【问题描述】:
我需要在 before_hook 中使用 tfsec 命令来扫描我的 terraform 代码
工作条件
terraform {
# Before apply, run script.
before_hook "scan_infra" {
commands = ["apply"]
execute = ["tfsec"]
}
非工作状态
terraform {
# Before apply, run script.
before_hook "scan_infra1" {
commands = ["apply"]
execute = ["tfsec --tfvars-file nsg.tfvars"]
}
# Before apply, run script.
before_hook "scan_infra2" {
commands = ["apply"]
execute = ["tfsec","--tfvars-file", "nsg.tfvars"]
}
抛出如下错误
:network_security_group tfsec$ terragrunt plan
INFO[0000] Executing hook: before_hook
ERRO[0000] Error running hook before_hook with message: exec: "tfsec --tfvars-file nsg.tfvars": executable file not found in $PATH
ERRO[0000] Errors encountered running before_hooks. Not running 'terraform'.
ERRO[0000] 1 error occurred:
* exec: "tfsec --tfvars-file nsg.tfvars": executable file not found in $PATH
ERRO[0000] Unable to determine underlying exit code, so Terragrunt will exit with error code 1
【问题讨论】:
标签: terraform terragrunt