Skip to content

googleProjectService

Allows management of a single API service for a Google Cloud Platform project.

For a list of services available, visit the API library page or run gcloudServicesListAvailable.

This resource requires the Service Usage API to use.

To get more information about googleProjectService, see:

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.projectService.ProjectService(this, "project", {
  disable_dependent_services: true,
  project: "your-project-id",
  service: "iam.googleapis.com",
  timeouts: [
    {
      create: "30m",
      update: "40m",
    },
  ],
});

Argument Reference

The following arguments are supported:

  • service - (Required) The service to enable.

  • project - (Optional) The project ID. If not provided, the provider project is used.

  • disableDependentServices - (Optional) If true, services that are enabled and which depend on this service should also be disabled when this service is destroyed. If false or unset, an error will be generated if any enabled services depend on this service when destroying it.

  • disableOnDestroy - (Optional) If true, disable the service when the Terraform resource is destroyed. Defaults to true. May be useful in the event that a project is long-lived but the infrastructure running in that project changes frequently.

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format {{project}}/{{service}}

Timeouts

This resource provides the following Timeouts configuration options: configuration options:

  • create - Default is 20 minutes.
  • read - Default is 10 minutes.
  • update - Default is 20 minutes.
  • delete - Default is 20 minutes.

Import

Project services can be imported using the projectId and service, e.g.

$ terraform import google_project_service.my_project your-project-id/iam.googleapis.com

Note that unlike other resources that fail if they already exist, terraformApply can be successfully used to verify already enabled services. This means that when importing existing resources into Terraform, you can either import the googleProjectService resources or treat them as new infrastructure and run terraformApply to add them to state.

User Project Overrides

This resource supports User Project Overrides.