Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
41 changes: 0 additions & 41 deletions infrastructure/aws/backend/.terraform.lock.hcl

This file was deleted.

4 changes: 2 additions & 2 deletions infrastructure/aws/dns/main.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
resource "aws_route53_zone" "public_zone" {
name = var.domain_name
force_destroy = true
force_destroy = false
}

resource "aws_route53_zone" "private_zone" {
name = var.domain_name
force_destroy = true
force_destroy = false
vpc {
vpc_id = var.vpc_id
}
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions infrastructure/aws/dns/tests/dns.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ run "private_zone_uses_same_domain" {
}
}

run "both_zones_force_destroy" {
run "both_zones_are_destroy_protected" {
command = plan

assert {
condition = aws_route53_zone.public_zone.force_destroy == true
error_message = "Public zone should have force_destroy enabled"
condition = aws_route53_zone.public_zone.force_destroy == false
error_message = "Public zone must not have force_destroy enabled (protects records against accidental deletion)"
}

assert {
condition = aws_route53_zone.private_zone.force_destroy == true
error_message = "Private zone should have force_destroy enabled"
condition = aws_route53_zone.private_zone.force_destroy == false
error_message = "Private zone must not have force_destroy enabled (protects records against accidental deletion)"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 0 additions & 5 deletions infrastructure/azure/acr/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ variable "containerregistry_name" {
}
}

variable "subscription_id" {
type = string
description = "The ID of the Azure subscription"
}

###############################################################################
# OPTIONAL VARIABLES - REGISTRY CONFIGURATION
###############################################################################
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 0 additions & 5 deletions infrastructure/azure/dns/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ variable "domain_name" {
description = "The domain name to use for the DNS zone (e.g., example.com)"
}

variable "subscription_id" {
type = string
description = "The ID of the Azure subscription"
}

###############################################################################
# OPTIONAL VARIABLES - TAGS
###############################################################################
Expand Down
File renamed without changes.
5 changes: 0 additions & 5 deletions infrastructure/azure/private_dns/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ variable "domain_name" {
description = "The domain name to use for the private DNS zone (e.g., privatelink.database.windows.net)"
}

variable "subscription_id" {
type = string
description = "The ID of the Azure subscription"
}

###############################################################################
# VNET LINK
###############################################################################
Expand Down
10 changes: 7 additions & 3 deletions infrastructure/gcp/acr/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ resource "google_artifact_registry_repository" "registry" {
labels = var.tags
}


resource "google_service_account" "artifact_sa" {
account_id = "artifact-registry-sa"
display_name = "Service Account for Artifact Registry"
Expand All @@ -20,7 +19,12 @@ resource "google_project_iam_member" "artifact_sa_role" {
member = "serviceAccount:${google_service_account.artifact_sa.email}"
}

resource "google_service_account_key" "artifact_sa_key" {
resource "google_service_account_iam_member" "workload_identity" {
for_each = {
for wi in var.workload_identity_bindings : "${wi.namespace}-${wi.ksa_name}" => wi
}

service_account_id = google_service_account.artifact_sa.name
public_key_type = "TYPE_X509_PEM_FILE"
role = "roles/iam.workloadIdentityUser"
member = "serviceAccount:${var.project_id}.svc.id.goog[${each.value.namespace}/${each.value.ksa_name}]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ output "acr_login_server" {
value = "${var.location}-docker.pkg.dev/${var.project_id}/${var.containerregistry_name}"
}

output "service_account_key_json" {
description = "The Service Account key for container registry access"
value = google_service_account_key.artifact_sa_key.private_key
sensitive = true
output "service_account_email" {
description = "GCP Service Account email. Annotate the Kubernetes ServiceAccount bound via workload_identity_bindings with iam.gke.io/gcp-service-account=<this value> to impersonate this account from pods."
value = google_service_account.artifact_sa.email
}
File renamed without changes.
9 changes: 9 additions & 0 deletions infrastructure/gcp/acr/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,12 @@ variable "tags" {
description = "A mapping of labels to assign to the container registry"
default = {}
}

variable "workload_identity_bindings" {
description = "Kubernetes ServiceAccounts allowed to impersonate the GCP Service Account via Workload Identity. Each entry grants roles/iam.workloadIdentityUser on the GSA to the KSA identified by namespace/ksa_name."
type = list(object({
namespace = string
ksa_name = string
}))
default = []
}
10 changes: 7 additions & 3 deletions infrastructure/gcp/artifact-registry/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ resource "google_artifact_registry_repository" "registry" {
format = var.format
}


resource "google_service_account" "artifact_sa" {
account_id = "artifact-registry-sa"
display_name = "Service Account para Artifact Registry"
Expand All @@ -18,7 +17,12 @@ resource "google_project_iam_member" "artifact_sa_role" {
member = "serviceAccount:${google_service_account.artifact_sa.email}"
}

resource "google_service_account_key" "artifact_sa_key" {
resource "google_service_account_iam_member" "workload_identity" {
for_each = {
for wi in var.workload_identity_bindings : "${wi.namespace}-${wi.ksa_name}" => wi
}

service_account_id = google_service_account.artifact_sa.name
public_key_type = "TYPE_X509_PEM_FILE"
role = "roles/iam.workloadIdentityUser"
member = "serviceAccount:${var.project_id}.svc.id.goog[${each.value.namespace}/${each.value.ksa_name}]"
}
13 changes: 7 additions & 6 deletions infrastructure/gcp/artifact-registry/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
output "repository_id" {
value = google_artifact_registry_repository.registry.repository_id
description = "The Artifact Registry repository ID"
value = google_artifact_registry_repository.registry.repository_id
}

output "repository_url" {
value = "${var.location}-docker.pkg.dev/${var.project_id}/${var.repository_id}"
description = "The fully-qualified Docker-compatible URL of the Artifact Registry repository"
value = "${var.location}-docker.pkg.dev/${var.project_id}/${var.repository_id}"
}

output "service_account_key_json" {
description = "Service Account key"
value = google_service_account_key.artifact_sa_key.private_key
sensitive = true
output "service_account_email" {
description = "GCP Service Account email. Annotate the Kubernetes ServiceAccount bound via workload_identity_bindings with iam.gke.io/gcp-service-account=<this value> to impersonate this account from pods."
value = google_service_account.artifact_sa.email
}
9 changes: 9 additions & 0 deletions infrastructure/gcp/artifact-registry/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@ variable "format" {
description = "The format (DOCKER, NPM, PYTHON, etc)"
default = "DOCKER"
}

variable "workload_identity_bindings" {
description = "Kubernetes ServiceAccounts allowed to impersonate the GCP Service Account via Workload Identity. Each entry grants roles/iam.workloadIdentityUser on the GSA to the KSA identified by namespace/ksa_name."
type = list(object({
namespace = string
ksa_name = string
}))
default = []
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading