可以通过Terraform设置云功能的秘密吗?
Terraform Google_cloudfunctions_function
资源文档列表秘密环境变量是可选的参数。我要么无法正确使用它,要么与文档相反,实际上并不支持它。
resource "google_cloudfunctions_function" "function" {
name = var.function_name
runtime = "nodejs16"
available_memory_mb = 128
source_archive_bucket = google_storage_bucket.bucket.name
source_archive_object = google_storage_bucket_object.zip.name
trigger_http = true
entry_point = var.function_entry_point
secret_environment_variables = []
}
结果:
错误:模块/云功能/main.tf上的不支持的参数 第51行,在资源“ Google__cloudfunctions_function”“ function”中: 51:secret_environment_variables = {}一个名为的参数 这里不期望“ secret_environment_variables”。你是说 定义类型“ secret_environment_variables”类型?
这是Terraform版本
的结果:
Terraform v1.1.9
on darwin_amd64
+ provider registry.terraform.io/hashicorp/archive v2.2.0
+ provider registry.terraform.io/hashicorp/external v2.2.2
+ provider registry.terraform.io/hashicorp/google v4.18.0
The Terraform google_cloudfunctions_function
resource documentation lists secret environment variables as an optional argument. I'm either not using it correctly or, contrary to the documentation, it's not in fact supported.
resource "google_cloudfunctions_function" "function" {
name = var.function_name
runtime = "nodejs16"
available_memory_mb = 128
source_archive_bucket = google_storage_bucket.bucket.name
source_archive_object = google_storage_bucket_object.zip.name
trigger_http = true
entry_point = var.function_entry_point
secret_environment_variables = []
}
results in:
Error: Unsupported argument on modules/cloud-function/main.tf
line 51, in resource "google_cloudfunctions_function" "function":
51: secret_environment_variables = {} An argument named
"secret_environment_variables" is not expected here. Did you mean to
define a block of type "secret_environment_variables"?
This is the result of terraform version
:
Terraform v1.1.9
on darwin_amd64
+ provider registry.terraform.io/hashicorp/archive v2.2.0
+ provider registry.terraform.io/hashicorp/external v2.2.2
+ provider registry.terraform.io/hashicorp/google v4.18.0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据文档,该密钥应为阻止。这是一个示例:
According to the documentation, that key should be block. Here is an example: