我有两个环境变量。一个是TF_VAR_UN
,另一个是TF_VAR_PW
。然后我有一个看起来像这样的 terraform 文件。
resource "google_container_cluster" "primary" {
name = "marcellus-wallace"
zone = "us-central1-a"
initial_node_count = 3
master_auth {
username = ${env.TF_VAR_UN}
password = ${env.TF_VAR_PW}
}
node_config {
oauth_scopes = [
"https://www.googleapis.com/auth/compute",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring"
]
}
}
我想用环境变量替换的两个值TF_VAR_UN
是TF_VAR_PW
用户名和密码。我尝试了上面显示的内容,但没有成功,我还玩弄了其他一些东西,但总是遇到语法问题。