使用Terraform将GCP云功能部署到工件注册表



我正在尝试使用Terraform将云函数部署到工件注册表,而不是容器注册表。

我在GCP中创建了一个工件库,并使用谷歌测试版提供程序。但我不明白在哪里可以提到";docker registry";path(工件注册表的路径(

以下是我的主tf文件的创建CF:-我添加了一个名为docker repository的参数(这在地形中不存在(,基于https://cloud.google.com/functions/docs/building#image_registry_options但看起来这个参数在地形中不存在,并且给了我错误。

resource "google_cloudfunctions_function" "appConfigService" {
provider              = google-beta
name                  = local.function_names.appConfigService
description           = "helloWorld"
runtime               = var.cf_node_run_time
available_memory_mb   = var.cf_memory
source_archive_bucket = local.deployment_bucket
source_archive_object = google_storage_bucket_object.appConfigService_archive.name
entry_point           = "helloWorld"
service_account_email = var.default_service_account[var.environment]
trigger_http          = true
docker-repository     ="<artifact registry path>" //This is wrong
}

我在任何地方都找不到任何关于这方面的文件。请让我知道使用terraform将云功能部署到工件存储库的正确方法。

此时,您需要使用Terraform加上Cloud Build来指定要使用的存储库。然后,您可以在云构建步骤中使用gcloud--docker存储库

本文档介绍了如何将Terraform与Cloud Build集成。

使用Terraform、Cloud Build和GitOps 将基础设施作为代码进行管理

最新更新