Skip to content

Instantly share code, notes, and snippets.

@philschmid
Created December 2, 2019 10:31
Show Gist options
  • Save philschmid/058515de6d1dee588e0785b1d2443f40 to your computer and use it in GitHub Desktop.
Save philschmid/058515de6d1dee588e0785b1d2443f40 to your computer and use it in GitHub Desktop.
cloudrun terraform
resource "google_cloud_run_service" "default" {
name = "tftest-cloudrun"
location = "us-central1"
provider = "google-beta"
metadata {
namespace = "my-project-name"
}
spec {
containers {
image = "gcr.io/cloudrun/hello"
env = [
{
name = "aws"
value = "123"
}
{
name = "aws"
value = "123"
}
]
}
}
}
# The Service is ready to be used when the "Ready" condition is True
# Due to Terraform and API limitations this is best accessed through a local variable
locals {
cloud_run_status = {
for cond in google_cloud_run_service.default.status[0].conditions :
cond.type => cond.status
}
}
output "isReady" {
value = local.cloud_run_status["Ready"] == "True"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment