Google cloud platform 通过Terraform got部署谷歌云功能;错误400:请求有错误,badRequest“;
我想通过Terraform部署云功能,但失败了Google cloud platform 通过Terraform got部署谷歌云功能;错误400:请求有错误,badRequest“;,google-cloud-platform,google-cloud-functions,Google Cloud Platform,Google Cloud Functions,我想通过Terraform部署云功能,但失败了 导出TF_LOG=DEBUG terraforminit 地形图#它不会失败 terraform应用#此失败 { "error": { "code": 400, "message": "The request has errors", "errors": [ { "message": "The request has errors", "domain": "global",
导出TF_LOG=DEBUG
terraforminit
地形图#它不会失败
terraform应用#此失败
{
"error": {
"code": 400,
"message": "The request has errors",
"errors": [
{
"message": "The request has errors",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
我累了什么
- 我试图将触发器更改为HTTP,但部署也失败了
- 启用TF_日志
- 做
,但成功了地形规划
resource "google_pubsub_topic" "topic" {
name = "rss-webhook-topic"
project = "${var.project_id}"
}
resource "google_cloudfunctions_function" "function" {
name = "rss-webhook-function"
entry_point = "helloGET"
available_memory_mb = 256
project = "${var.project_id}"
event_trigger {
event_type = "google.pubsub.topic.publish"
resource = "${google_pubsub_topic.topic.name}"
}
source_archive_bucket = "${var.bucket_name}"
source_archive_object = "${google_storage_bucket_object.archive.name}"
}
data "archive_file" "function_src" {
type = "zip"
output_path = "function_src.zip"
source {
content = "${file("src/index.js")}"
filename = "index.js"
}
}
resource "google_storage_bucket_object" "archive" {
name = "function_src.zip"
bucket = "${var.bucket_name}"
source = "function_src.zip"
depends_on = ["data.archive_file.function_src"]
}
环境
地形版本:0.11.13Go运行时版本:go1.12 +provider.archive v1.2.2 +provider.google v2.5.1属性“runtime”是必需的 下面的工作
resource "google_cloudfunctions_function" "function" {
name = "rss-webhook-function"
entry_point = "helloGET"
available_memory_mb = 256
project = "${var.project_id}"
runtime = "nodejs8"
event_trigger {
event_type = "google.pubsub.topic.publish"
resource = "${google_pubsub_topic.topic.name}"
}
source_archive_bucket = "${var.bucket_name}"
source_archive_object = "${google_storage_bucket_object.archive.name}"
}
这是在哪里定义的
google\u pubsub\u topic.topic.name
?我编辑我的帖子。原始模板有可以部署的主题。我不确定您对“原始模板有可以部署的主题”所说的是什么。您是说它正在工作吗?首先,我将主题添加到模板并部署。成功了。之后,我将云函数添加到模板中,部署失败。