Search code examples
google-cloud-platformterraformterraform-provider-gcp

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


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?


Solution

  • 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"
    }