Disable and enable Cloud Run service using Terraform is removing all deployed services

Viewed 253

Today, when I tried to disable and re-enable CloudRun service using Terraform, I observed that all the currently deployed CloudRun services are deleted. These are not disabled, actually deleted completely.

resource "google_project_service" "cloudrun" {
  project = var.project_id
  service = "run.googleapis.com"
}

This is a different behavior compared to any other google's serverless offerings. I disabled and re-enabled GCE API service and that kept all the existing GCE instances. Same is the case with Pub/Sub, CloudSQL etc.

Did anybody observe this behavior? Is this by design or a bug?

1 Answers

I would say it's likely due to this caveat about Cloud Run:

Cloud Run does not offer a direct way to make a service stop serving traffic

Source

Luckily if you are defining all of your Cloud-Run services via Terraform you should be able to re-deploy everything but agreed that it's inconsistent.

Related