Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I automatically enable APIs when using GCP cloud with terraform?

Tags:

I am very new to GCP with terraform and I want to deploy all my modules using centralized tools.

Is there any way to remove the step of enabling google API's every time so that deployment is not interrupted?

like image 326
user12417145 Avatar asked Nov 26 '19 16:11

user12417145


People also ask

What is the purpose of running Terraform through the Google Cloud Platform cloud Shell?

With Terraform installed, you are ready to create some infrastructure. You will build infrastructure on Google Cloud Platform (GCP) for this tutorial, but Terraform can manage a wide variety of resources using providers. You can find more examples in the use cases section.


1 Answers

There is a Terraform resource definition called "google_project_service" that allows one to enable a service (API). This is documented at google_project_service.

An example of usage appears to be:

resource "google_project_service" "project" {
  project = "your-project-id"
  service = "iam.googleapis.com"
}
like image 88
Kolban Avatar answered Sep 20 '22 19:09

Kolban