Created
December 2, 2019 10:31
-
-
Save philschmid/058515de6d1dee588e0785b1d2443f40 to your computer and use it in GitHub Desktop.
cloudrun terraform
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
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