Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dffc480eb9 | |||
| 2358b9fe43 |
@@ -1,7 +1,7 @@
|
||||
services:
|
||||
jmespath-playground:
|
||||
build: .
|
||||
image: skoszewski/jmespath-playground
|
||||
image: skoszewski/jmespath-playground:latest
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
|
||||
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