是否可以使用local-exec为Terraform .tf文件内部的变量生成输出?
答案 0 :(得分:2)
Terraform的数据外部功能对我有帮助
jq -n --arg username $(git config user.name) '{"username": $username}'
data "external" "owner_tag_generator" {
program = ["bash", "/full/path/of/owner.sh"]
}
output "owner" {
value = "${data.external.owner_tag_generator.result}"
}
tags {
...
CreatorName = "${data.external.owner_tag_generator.result.username}"
...
}