Compare commits
1 Commits
1.4.3
...
2358b9fe43
| Author | SHA1 | Date | |
|---|---|---|---|
| 2358b9fe43 |
7
terraform/.gitignore
vendored
Normal file
7
terraform/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# Terraform
|
||||||
|
*.tfstate
|
||||||
|
*.tfstate.*
|
||||||
|
.terraform/
|
||||||
|
.terraform.lock.hcl
|
||||||
|
.terraform.lock.hcl.backup
|
||||||
|
*tfplan
|
||||||
41
terraform/main.tf
Normal file
41
terraform/main.tf
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
13
terraform/providers.tf
Normal file
13
terraform/providers.tf
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
google = {
|
||||||
|
source = "hashicorp/google"
|
||||||
|
version = "~>7.17.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "google" {
|
||||||
|
project = var.project_id
|
||||||
|
region = var.default_region
|
||||||
|
}
|
||||||
5
terraform/terraform.tfvars.json
Normal file
5
terraform/terraform.tfvars.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"project_id": "dom-lab",
|
||||||
|
"image_version": "1.4.3",
|
||||||
|
"deletion_protection": true
|
||||||
|
}
|
||||||
21
terraform/variables.tf
Normal file
21
terraform/variables.tf
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
variable "project_id" {
|
||||||
|
description = "Google project id"
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "default_region" {
|
||||||
|
description = "Default Google Cloud region"
|
||||||
|
type = string
|
||||||
|
default = "europe-west1" # Belgium
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "image_version" {
|
||||||
|
description = "Version of the Docker image"
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "deletion_protection" {
|
||||||
|
type = bool
|
||||||
|
description = "Protect resources from deletion using terraform destroy and apply."
|
||||||
|
default = true
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user