Использование дозорного импорта при разработке политик в terraform
Эй, я пытаюсь работать с Sentinel Cli с Terraform У меня есть файл policy.sentinel
import "tfplan"
allowed_machine_types = [
"n1-standard-1",
"n1-standard-2",
"n1-standard-4",
"n1-standard-8",
]
main = rule {
all tfplan.resources as type, resources {
all resources as r {
r.applied.machine_type in allowed_machine_types
}
}
}
и файл config.json для моего импорта
{
"imports":{
"tfplan": {
"path": "./plan"
}
}
}
план представляет собой исполняемый файл, который создается после запуска
terraform plan -out plan
когда я бегу sentinel apply -config=config.json policy.sentinel
моя ошибка
Runtime error while running the policy:
test.sentinel:1:1: fork/exec ./plan: exec format error
A runtime error is a non-recoverable error and always represents a bug
in the policy. When a runtime error is experienced, the result of the
policy is "false". Please fix the error above and try again.
я не очень хорош в страже, так что может быть проблемой? как мы используем импорт? я пытался просмотреть документацию и не мог понять, как это сделать
1 ответ
Вы не можете выполнить файл плана, так как он не является исполняемым - вам нужно запустить плагин Terraform Plan: он нигде не доступен..