Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ojhaujjwal
Last active May 12, 2020 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ojhaujjwal/eb38b9cd664919bfe461d91a1d673e86 to your computer and use it in GitHub Desktop.
Save ojhaujjwal/eb38b9cd664919bfe461d91a1d673e86 to your computer and use it in GitHub Desktop.
variable "app_name" {
type=string
}
variable "image_tag" { type=string }
resource "google_cloud_run_service" "nodejs_app" {
name = var.app_name
location = "us-central1"
template {
spec {
containers {
image = "gcr.io/YOUR-PROJECT-ID/${var.app_name}:${var.image_tag}"
env {
name = "NODE_ENV"
value = "production"
}
env {
name = "SOME_ENV_VAR"
value = "some-value"
}
}
}
metadata {
namespace = 'YOUR_PROJECT_ID'
annotations = {
"autoscaling.knative.dev/maxScale" = "2" // maxinum number containers you want to spin
"run.googleapis.com/client-name" = "cloud-console"
}
}
}
traffic {
percent = 100
latest_revision = true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment