Reputation: 125
I am trying to deploy cloud function to artifact registry instead of container registry using Terraform.
I have created an artifact repository in GCP and Using the google-beta provider. But I am not able to understand where to mention "docker-registry" path(path for artifact 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.
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.
Upvotes: 2
Views: 2423
Reputation: 81356
At this time, your will need to use Terraform plus Cloud Build to specify the repository to use. You can then use gcloud --docker-repository in a Cloud Build step.
This document explains how to integrate Terraform with Cloud Build.
Managing infrastructure as code with Terraform, Cloud Build, and GitOps
Upvotes: 0