1. Packages
  2. Packages
  3. Gitlab Provider
  4. API Docs
  5. getProjectServiceAccount
Viewing docs for GitLab v10.0.0
published on Friday, Jun 26, 2026 by Pulumi
gitlab logo
Viewing docs for GitLab v10.0.0
published on Friday, Jun 26, 2026 by Pulumi

    The gitlab.ProjectServiceAccount data source retrieves information about a GitLab service account in a project.

    Upstream API: GitLab REST API docs

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gitlab from "@pulumi/gitlab";
    
    const example = gitlab.getProject({
        id: "foo/bar",
    });
    // Basic example
    const exampleGetProjectServiceAccount = example.then(example => gitlab.getProjectServiceAccount({
        serviceAccountId: "1",
        project: example.id,
    }));
    
    import pulumi
    import pulumi_gitlab as gitlab
    
    example = gitlab.get_project(id="foo/bar")
    # Basic example
    example_get_project_service_account = gitlab.get_project_service_account(service_account_id="1",
        project=example.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gitlab/sdk/v10/go/gitlab"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := gitlab.GetProject(ctx, &gitlab.LookupProjectArgs{
    			Id: pulumi.StringRef("foo/bar"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// Basic example
    		_, err = gitlab.GetProjectServiceAccount(ctx, &gitlab.LookupProjectServiceAccountArgs{
    			ServiceAccountId: "1",
    			Project:          example.Id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using GitLab = Pulumi.GitLab;
    
    return await Deployment.RunAsync(() => 
    {
        var example = GitLab.GetProject.Invoke(new()
        {
            Id = "foo/bar",
        });
    
        // Basic example
        var exampleGetProjectServiceAccount = GitLab.GetProjectServiceAccount.Invoke(new()
        {
            ServiceAccountId = "1",
            Project = example.Apply(getProjectResult => getProjectResult.Id),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gitlab.GitlabFunctions;
    import com.pulumi.gitlab.inputs.GetProjectArgs;
    import com.pulumi.gitlab.inputs.GetProjectServiceAccountArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 example = GitlabFunctions.getProject(GetProjectArgs.builder()
                .id("foo/bar")
                .build());
    
            // Basic example
            final var exampleGetProjectServiceAccount = GitlabFunctions.getProjectServiceAccount(GetProjectServiceAccountArgs.builder()
                .serviceAccountId("1")
                .project(example.id())
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: gitlab:getProject
          arguments:
            id: foo/bar
      # Basic example
      exampleGetProjectServiceAccount:
        fn::invoke:
          function: gitlab:getProjectServiceAccount
          arguments:
            serviceAccountId: 1
            project: ${example.id}
    
    pulumi {
      required_providers {
        gitlab = {
          source = "pulumi/gitlab"
        }
      }
    }
    
    data "gitlab_getproject" "example" {
      id = "foo/bar"
    }
    data "gitlab_getprojectserviceaccount" "exampleGetProjectServiceAccount" {
      service_account_id = 1
      project            = data.gitlab_getproject.example.id
    }
    
    # Basic example
    

    Using getProjectServiceAccount

    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 getProjectServiceAccount(args: GetProjectServiceAccountArgs, opts?: InvokeOptions): Promise<GetProjectServiceAccountResult>
    function getProjectServiceAccountOutput(args: GetProjectServiceAccountOutputArgs, opts?: InvokeOptions): Output<GetProjectServiceAccountResult>
    def get_project_service_account(project: Optional[str] = None,
                                    service_account_id: Optional[str] = None,
                                    opts: Optional[InvokeOptions] = None) -> GetProjectServiceAccountResult
    def get_project_service_account_output(project: pulumi.Input[Optional[str]] = None,
                                    service_account_id: pulumi.Input[Optional[str]] = None,
                                    opts: Optional[InvokeOptions] = None) -> Output[GetProjectServiceAccountResult]
    func LookupProjectServiceAccount(ctx *Context, args *LookupProjectServiceAccountArgs, opts ...InvokeOption) (*LookupProjectServiceAccountResult, error)
    func LookupProjectServiceAccountOutput(ctx *Context, args *LookupProjectServiceAccountOutputArgs, opts ...InvokeOption) LookupProjectServiceAccountResultOutput

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

    public static class GetProjectServiceAccount 
    {
        public static Task<GetProjectServiceAccountResult> InvokeAsync(GetProjectServiceAccountArgs args, InvokeOptions? opts = null)
        public static Output<GetProjectServiceAccountResult> Invoke(GetProjectServiceAccountInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetProjectServiceAccountResult> getProjectServiceAccount(GetProjectServiceAccountArgs args, InvokeOptions options)
    public static Output<GetProjectServiceAccountResult> getProjectServiceAccount(GetProjectServiceAccountArgs args, InvokeOptions options)
    
    fn::invoke:
      function: gitlab:index/getProjectServiceAccount:getProjectServiceAccount
      arguments:
        # arguments dictionary
    data "gitlab_getprojectserviceaccount" "name" {
        # arguments
    }

    The following arguments are supported:

    Project string
    The ID or URL-encoded path of the target project.
    ServiceAccountId string
    The service account id.
    Project string
    The ID or URL-encoded path of the target project.
    ServiceAccountId string
    The service account id.
    project string
    The ID or URL-encoded path of the target project.
    service_account_id string
    The service account id.
    project String
    The ID or URL-encoded path of the target project.
    serviceAccountId String
    The service account id.
    project string
    The ID or URL-encoded path of the target project.
    serviceAccountId string
    The service account id.
    project str
    The ID or URL-encoded path of the target project.
    service_account_id str
    The service account id.
    project String
    The ID or URL-encoded path of the target project.
    serviceAccountId String
    The service account id.

    getProjectServiceAccount Result

    The following output properties are available:

    Id string
    The ID of this Terraform resource. In the format of <project>:<service_account_id>.
    Name string
    The name of the user. If not specified, the default Service account user name is used.
    Project string
    The ID or URL-encoded path of the target project.
    ServiceAccountId string
    The service account id.
    Username string
    The username of the user. If not specified, it's automatically generated.
    Id string
    The ID of this Terraform resource. In the format of <project>:<service_account_id>.
    Name string
    The name of the user. If not specified, the default Service account user name is used.
    Project string
    The ID or URL-encoded path of the target project.
    ServiceAccountId string
    The service account id.
    Username string
    The username of the user. If not specified, it's automatically generated.
    id string
    The ID of this Terraform resource. In the format of <project>:<service_account_id>.
    name string
    The name of the user. If not specified, the default Service account user name is used.
    project string
    The ID or URL-encoded path of the target project.
    service_account_id string
    The service account id.
    username string
    The username of the user. If not specified, it's automatically generated.
    id String
    The ID of this Terraform resource. In the format of <project>:<service_account_id>.
    name String
    The name of the user. If not specified, the default Service account user name is used.
    project String
    The ID or URL-encoded path of the target project.
    serviceAccountId String
    The service account id.
    username String
    The username of the user. If not specified, it's automatically generated.
    id string
    The ID of this Terraform resource. In the format of <project>:<service_account_id>.
    name string
    The name of the user. If not specified, the default Service account user name is used.
    project string
    The ID or URL-encoded path of the target project.
    serviceAccountId string
    The service account id.
    username string
    The username of the user. If not specified, it's automatically generated.
    id str
    The ID of this Terraform resource. In the format of <project>:<service_account_id>.
    name str
    The name of the user. If not specified, the default Service account user name is used.
    project str
    The ID or URL-encoded path of the target project.
    service_account_id str
    The service account id.
    username str
    The username of the user. If not specified, it's automatically generated.
    id String
    The ID of this Terraform resource. In the format of <project>:<service_account_id>.
    name String
    The name of the user. If not specified, the default Service account user name is used.
    project String
    The ID or URL-encoded path of the target project.
    serviceAccountId String
    The service account id.
    username String
    The username of the user. If not specified, it's automatically generated.

    Package Details

    Repository
    GitLab pulumi/pulumi-gitlab
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the gitlab Terraform Provider.
    gitlab logo
    Viewing docs for GitLab v10.0.0
    published on Friday, Jun 26, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial