Add Terraform configuration files for Cloud Run service deployment

This commit is contained in:
2026-02-02 22:39:58 +01:00
parent 0818f634dc
commit 2358b9fe43
5 changed files with 87 additions and 0 deletions

41
terraform/main.tf Normal file
View File

@@ -0,0 +1,41 @@
# Create Cloud Run service
resource "google_cloud_run_v2_service" "jppg" {
name = "jmespath-playground"
location = var.default_region
invoker_iam_disabled = true
template {
containers {
image = "skoszewski/jmespath-playground:${var.image_version}"
name = "jmespath-playground-1"
ports {
container_port = 3000
}
}
}
scaling {
max_instance_count = 1
}
deletion_protection = var.deletion_protection
lifecycle {
ignore_changes = [
client
]
}
}
resource "google_cloud_run_domain_mapping" "jppg" {
name = "jmespath-playground.gcp-lab.koszewscy.waw.pl"
location = var.default_region
spec {
route_name = google_cloud_run_v2_service.jppg.name
}
metadata {
namespace = var.project_id
}
}