1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. projects
  5. getProjectService
Google Cloud v8.25.0 published on Thursday, Apr 3, 2025 by Pulumi

gcp.projects.getProjectService

Explore with Pulumi AI

Google Cloud v8.25.0 published on Thursday, Apr 3, 2025 by Pulumi

Verify the API service for the Google Cloud Platform project to see if it is enabled or not.

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

This datasource requires the Service Usage API to use.

To get more information about gcp.projects.Service, see:

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const my_project_service = gcp.projects.getProjectService({
    service: "my-project-service",
});
Copy
import pulumi
import pulumi_gcp as gcp

my_project_service = gcp.projects.get_project_service(service="my-project-service")
Copy
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/projects"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := projects.GetProjectService(ctx, &projects.GetProjectServiceArgs{
			Service: "my-project-service",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var my_project_service = Gcp.Projects.GetProjectService.Invoke(new()
    {
        Service = "my-project-service",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.projects.ProjectsFunctions;
import com.pulumi.gcp.projects.inputs.GetProjectServiceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var my-project-service = ProjectsFunctions.getProjectService(GetProjectServiceArgs.builder()
            .service("my-project-service")
            .build());

    }
}
Copy
variables:
  my-project-service:
    fn::invoke:
      function: gcp:projects:getProjectService
      arguments:
        service: my-project-service
Copy

Using getProjectService

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getProjectService(args: GetProjectServiceArgs, opts?: InvokeOptions): Promise<GetProjectServiceResult>
function getProjectServiceOutput(args: GetProjectServiceOutputArgs, opts?: InvokeOptions): Output<GetProjectServiceResult>
Copy
def get_project_service(project: Optional[str] = None,
                        service: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetProjectServiceResult
def get_project_service_output(project: Optional[pulumi.Input[str]] = None,
                        service: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetProjectServiceResult]
Copy
func GetProjectService(ctx *Context, args *GetProjectServiceArgs, opts ...InvokeOption) (*GetProjectServiceResult, error)
func GetProjectServiceOutput(ctx *Context, args *GetProjectServiceOutputArgs, opts ...InvokeOption) GetProjectServiceResultOutput
Copy

> Note: This function is named GetProjectService in the Go SDK.

public static class GetProjectService 
{
    public static Task<GetProjectServiceResult> InvokeAsync(GetProjectServiceArgs args, InvokeOptions? opts = null)
    public static Output<GetProjectServiceResult> Invoke(GetProjectServiceInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetProjectServiceResult> getProjectService(GetProjectServiceArgs args, InvokeOptions options)
public static Output<GetProjectServiceResult> getProjectService(GetProjectServiceArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: gcp:projects/getProjectService:getProjectService
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Service This property is required. string
The name of the Google Platform project service.


Project string
The project in which the resource belongs. If it is not provided, the provider project is used.
Service This property is required. string
The name of the Google Platform project service.


Project string
The project in which the resource belongs. If it is not provided, the provider project is used.
service This property is required. String
The name of the Google Platform project service.


project String
The project in which the resource belongs. If it is not provided, the provider project is used.
service This property is required. string
The name of the Google Platform project service.


project string
The project in which the resource belongs. If it is not provided, the provider project is used.
service This property is required. str
The name of the Google Platform project service.


project str
The project in which the resource belongs. If it is not provided, the provider project is used.
service This property is required. String
The name of the Google Platform project service.


project String
The project in which the resource belongs. If it is not provided, the provider project is used.

getProjectService Result

The following output properties are available:

CheckIfServiceHasUsageOnDestroy bool
DisableDependentServices bool
DisableOnDestroy bool
Id string
The provider-assigned unique ID for this managed resource.
Service string
Project string
CheckIfServiceHasUsageOnDestroy bool
DisableDependentServices bool
DisableOnDestroy bool
Id string
The provider-assigned unique ID for this managed resource.
Service string
Project string
checkIfServiceHasUsageOnDestroy Boolean
disableDependentServices Boolean
disableOnDestroy Boolean
id String
The provider-assigned unique ID for this managed resource.
service String
project String
checkIfServiceHasUsageOnDestroy boolean
disableDependentServices boolean
disableOnDestroy boolean
id string
The provider-assigned unique ID for this managed resource.
service string
project string
check_if_service_has_usage_on_destroy bool
disable_dependent_services bool
disable_on_destroy bool
id str
The provider-assigned unique ID for this managed resource.
service str
project str
checkIfServiceHasUsageOnDestroy Boolean
disableDependentServices Boolean
disableOnDestroy Boolean
id String
The provider-assigned unique ID for this managed resource.
service String
project String

Package Details

Repository
Google Cloud (GCP) Classic pulumi/pulumi-gcp
License
Apache-2.0
Notes
This Pulumi package is based on the google-beta Terraform Provider.
Google Cloud v8.25.0 published on Thursday, Apr 3, 2025 by Pulumi