How to Fully Automate the Deployment of Google Cloud Platform Projects with Terraform

A workaround to a known Google Cloud API catch-22 issue

Edoardo Nosotti
RockedScience

--

Photo by John Barkiple on Unsplash

The folks at Google Cloud Platform seem to love Terraform. They embraced it so much to advertise it in their own documentation, providing tutorials, courses, reference modules, validation and import tools. Also, I haven’t heard a lot about their native Cloud Deployment Manager lately. So it feels like Terraform has become the go-to Infrastructure-as-Code tool to manage deployments on the Google Cloud Platform.

As a Terraform fan and a Google Cloud Platform user, I am more than happy.
Yet, creating a new Google Cloud Platform project from scratch with Terraform is tricky (at the time of writing) and gets in the way of full infrastructure automation. According to this thread on Stack Overflow, the issue is not strictly related to Terraform, it comes from the underlying platform API that leads to a catch-22 situation.

In the Google Cloud Platform, individual Service APIs must be enabled in each project for services to become available. If you try to use a service via the web console and its Service API is is not enabled, you are automatically redirected to its page in the API Library and given the option to enable it.
Although the…

--

--

Edoardo Nosotti
RockedScience

Certified Cybersecurity Analyst and Senior Cloud Solutions Architect. Passionate about IoT, AI, ML and automation.