Managing Google Cloud API Gateway with Terraform

We are currently using terraform to provision our infrastructure on GCP. One of the resources we are managing with terraform is our Google API Gateway. We have created a “google_api_gateway_api” resource and have paired it with a “google_api_gateway_api_config” and “google_api_gateway_gateway”. The problem we are facing is that every time the configuration is updated, the existing configuration and gateway are destroyed and re-created, resulting in downtime for our gateway.

Using the Google Cloud UI, there is a way to add a new configuration without destroying the existing one and taking down the gateway. How would we accomplish this using terraform? We have tried using the lifecycle { create_before_destroy = true } block within “google_api_gateway_api_config” , but this results in a 409 resource already exists error.

1 Like