Open Djabx opened 6 months ago
Hi @Djabx!
I tried to replicate this issue but after creating the resources with a terraform apply
everything works without errors. I suggest you to follow this terraform registry configuration and read the documentation and argument reference.
This is the used code:
variables.tf:
variable "create_proxy_gcr" {
type = bool
default = true
}
variable "create_proxy_docker" {
type = bool
default = true
}
main.tf:
provider "google" {}
terraform {
required_providers {
google = {
source = "hashicorp/google-beta"
version = "5.29.1"
}
}
}
resource "google_artifact_registry_repository" "proxy_docker_repository_18143" {
location = "us-central1"
repository_id = "proxy-docker-repository-18143"
description = "something"
format = "DOCKER"
count = var.create_proxy_docker ? 1 : 0
}
resource "google_artifact_registry_repository" "proxy_gcr_repository_18143" {
location = "us-central1"
repository_id = "proxy-gcr-repository-18143"
description = "something"
format = "DOCKER"
count = var.create_proxy_gcr ? 1 : 0
}
resource "google_artifact_registry_repository" "artifact_registry_repository_18143" {
depends_on = []
location = "us-central1"
repository_id = "artifact-registry-repository-18143"
description = "something"
format = "DOCKER"
mode = "VIRTUAL_REPOSITORY"
virtual_repository_config {
dynamic "upstream_policies" {
for_each = var.create_proxy_gcr ? [1] : []
content {
id = "proxy-gcr"
repository = google_artifact_registry_repository.proxy_gcr_repository_18143[0].id
priority = 30
}
}
dynamic "upstream_policies" {
for_each = var.create_proxy_docker ? [1] : []
content {
id = "proxy-docker"
repository = google_artifact_registry_repository.proxy_docker_repository_18143[0].id
priority = 20
}
}
}
}
Community Note
Terraform Version & Provider Version(s)
Terraform v1.8.3 on x86_64
Affected Resource(s)
google_artifact_registry_repository
Terraform Configuration
Debug Output
No response
Expected Behavior
No response
Actual Behavior
Plan output
During apply
Steps to reproduce
The issue is not consistent. Sometime it work without any issue. But the same pipeline / same commit, when nothing have change on the registry, may fail but could work again after.
terraform apply
Important Factoids
No response
References
No response