简体   繁体   English

使用 Terraform 将 GCP 云功能部署到 Artifact Registry

[英]Deploy GCP Cloud functions to Artifact Registry using Terraform

I am trying to deploy cloud function to artifact registry instead of container registry using Terraform.我正在尝试使用 Terraform 将云 function 部署到工件注册表而不是容器注册表。

I have created an artifact repository in GCP and Using the google-beta provider.我在 GCP 中创建了一个工件存储库并使用了 google-beta 提供程序。 But I am not able to understand where to mention "docker-registry" path(path for artifact registry)但我无法理解在哪里提及“docker-registry”路径(工件注册表路径)

Following in my main tf file's create CF:- I have added a parameter called docker-repository(this doesn't exist in terraform) based on https://cloud.google.com/functions/docs/building#image_registry_options But looks like this parameter doesn't exist in terraform and is giving me errors.在我的主要 tf 文件的创建 CF 之后:- 我添加了一个名为 docker-repository 的参数(这在 terraform 中不存在)基于https://cloud.google.com/functions/docs/building#image_registry_options但看起来像此参数在 terraform 中不存在,并且给我错误。

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

}

I am not able to find any documentation on this anywhere.我无法在任何地方找到任何关于此的文档。 Please let me know the correct way of deploying Cloud functions to artifact repository using terraform.请让我知道使用 terraform 将云功能部署到工件存储库的正确方法。

At this time, your will need to use Terraform plus Cloud Build to specify the repository to use.这时候你需要使用Terraform加上Cloud Build来指定要使用的仓库。 You can then use gcloud --docker-repository in a Cloud Build step.然后,您可以在云构建步骤中使用 gcloud --docker-repository

This document explains how to integrate Terraform with Cloud Build.本文档介绍了如何将 Terraform 与 Cloud Build 集成。

Managing infrastructure as code with Terraform, Cloud Build, and GitOps 使用 Terraform、Cloud Build 和 GitOps 将基础架构作为代码进行管理

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Terraform 使用来自 Artifact Registry 的 Docker 映像部署 GKE 工作负载? - How do I deploy a GKE Workload with my Docker image from the Artifact Registry using Terraform? 使用 terraform 和 helm 部署 GKE 时出现 Google 云工件注册表问题 - Google cloud artifact registry issue when deploying GKE with terraform and helm 如何将 Firestore 侦听器功能部署到 GCP Cloud? - How to deploy Firestore listener functions to GCP Cloud? 无法使用 OCI 将 Helm Chart 推送到 Google Cloud Artifact Registry - Unable to push Helm Chart to Google Cloud Artifact Registry using OCI 如何将 spring 启动应用程序部署到 GCP 云功能? - How to deploy spring boot application to GCP cloud functions? 谷歌云:Artifact Registry 与 Container Registry - Google Cloud: Artifact Registry vs Container Registry terraform GCP 云 function 无需通过 terraform 在 CI 中部署或在本地运行时打破过去的部署? - terraform GCP cloud function without having to deploy via terraform in CI or breaking past deployments when running locally? GCP:如何修剪/维护工件注册表存储? - GCP: How to prune/maintain Artifact Registry storage? 如何从工件注册表(GCP)下载 jar? - How to download jar from artifact registry (GCP)? Google Cloud Container Registry/Artifact Registry 权限 - Google Cloud Container Registry/Artifact Registry Permissions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM