我在 Terraform Cloud 工作区中使用 Sentinel 策略。我的策略很简单:
import "tfplan/v2" as tfplan
allBDs = tfplan.find_resources("aci_bridge_domain")
violatingBDs = tfplan.filter_attribute_does_not_match_regex(allBDs,
"description", "^demo(.+)", true)
main = rule {
length(violatingBDs["messages"]) is 0
}
不幸的是,使用此消息调用它时失败:
An error occurred: 1 error occurred:
* ./allowed-terraform-version.sentinel:3:10: key "find_resources" doesn't support function calls
find_resources ( doc ) 的文档和源代码需要一个字符串,但 Sentinel 解释器似乎认为我正在调用 tfplan 的方法?尚不清楚为什么会这样,并且文档并没有真正的帮助。
有任何想法吗?