From 481e9e26df3c7b328d24ed903ff6a8ad6ff71efe Mon Sep 17 00:00:00 2001 From: Swapnesh Khare Date: Wed, 8 Jan 2025 16:49:17 +0530 Subject: [PATCH] update google terraform version, replace container registry by artifact registry --- .../stages/infrastructure/template/gcp/main.tf | 3 +++ .../template/gcp/modules/registry/main.tf | 7 +++++-- .../template/gcp/modules/registry/variables.tf | 15 +++++++++++++-- .../infrastructure/template/gcp/versions.tf | 2 +- .../stages/terraform_state/template/gcp/main.tf | 2 +- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/_nebari/stages/infrastructure/template/gcp/main.tf b/src/_nebari/stages/infrastructure/template/gcp/main.tf index 3d23af5571..ec80cefe16 100644 --- a/src/_nebari/stages/infrastructure/template/gcp/main.tf +++ b/src/_nebari/stages/infrastructure/template/gcp/main.tf @@ -5,6 +5,9 @@ data "google_compute_zones" "gcpzones" { module "registry-jupyterhub" { source = "./modules/registry" + + repository_id = "${var.name}-${var.environment}" + location = var.region } diff --git a/src/_nebari/stages/infrastructure/template/gcp/modules/registry/main.tf b/src/_nebari/stages/infrastructure/template/gcp/modules/registry/main.tf index a4e35bf1a3..9403872737 100644 --- a/src/_nebari/stages/infrastructure/template/gcp/modules/registry/main.tf +++ b/src/_nebari/stages/infrastructure/template/gcp/modules/registry/main.tf @@ -1,3 +1,6 @@ -resource "google_container_registry" "registry" { - location = var.location +resource "google_artifact_registry_repository" "registry" { + # https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/artifact_registry_repository#argument-reference + repository_id = var.repository_id + location = var.location + format = var.format } diff --git a/src/_nebari/stages/infrastructure/template/gcp/modules/registry/variables.tf b/src/_nebari/stages/infrastructure/template/gcp/modules/registry/variables.tf index 39f6d5ed28..9162425fa1 100644 --- a/src/_nebari/stages/infrastructure/template/gcp/modules/registry/variables.tf +++ b/src/_nebari/stages/infrastructure/template/gcp/modules/registry/variables.tf @@ -1,6 +1,17 @@ variable "location" { - # https://cloud.google.com/container-registry/docs/pushing-and-pulling#pushing_an_image_to_a_registry + # https://cloud.google.com/artifact-registry/docs/docker/pushing-and-pulling description = "Location of registry" type = string - default = "US" +} + +variable "format" { + # https://cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations.repositories#Format + description = "The format of packages that are stored in the repository" + type = string + default = "DOCKER" +} + +variable "repository_id" { + description = "Name of repository" + type = string } diff --git a/src/_nebari/stages/infrastructure/template/gcp/versions.tf b/src/_nebari/stages/infrastructure/template/gcp/versions.tf index ddea3c185c..92bd117367 100644 --- a/src/_nebari/stages/infrastructure/template/gcp/versions.tf +++ b/src/_nebari/stages/infrastructure/template/gcp/versions.tf @@ -2,7 +2,7 @@ terraform { required_providers { google = { source = "hashicorp/google" - version = "4.8.0" + version = "6.14.1" } } required_version = ">= 1.0" diff --git a/src/_nebari/stages/terraform_state/template/gcp/main.tf b/src/_nebari/stages/terraform_state/template/gcp/main.tf index dea6c03ac0..34a45d354a 100644 --- a/src/_nebari/stages/terraform_state/template/gcp/main.tf +++ b/src/_nebari/stages/terraform_state/template/gcp/main.tf @@ -24,7 +24,7 @@ terraform { required_providers { google = { source = "hashicorp/google" - version = "4.83.0" + version = "6.14.1" } } required_version = ">= 1.0"