Last active
May 12, 2020 14:41
-
-
Save ojhaujjwal/eb38b9cd664919bfe461d91a1d673e86 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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