Google Cloud v8.21.0 published on Wednesday, Mar 5, 2025 by Pulumi
gcp.serviceaccount.getS
Explore with Pulumi AI
Gets a list of all service accounts from a project. See the official documentation and API.
Example Usage
Get all service accounts from a project
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const example = gcp.serviceaccount.getS({
    project: "example-project",
});
import pulumi
import pulumi_gcp as gcp
example = gcp.serviceaccount.get_s(project="example-project")
package main
import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/serviceaccount"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := serviceaccount.GetS(ctx, &serviceaccount.GetSArgs{
			Project: pulumi.StringRef("example-project"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() => 
{
    var example = Gcp.ServiceAccount.GetS.Invoke(new()
    {
        Project = "example-project",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.serviceaccount.ServiceaccountFunctions;
import com.pulumi.gcp.serviceaccount.inputs.GetSArgs;
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 example = ServiceaccountFunctions.getS(GetSArgs.builder()
            .project("example-project")
            .build());
    }
}
variables:
  example:
    fn::invoke:
      function: gcp:serviceaccount:getS
      arguments:
        project: example-project
Get all service accounts that are prefixed with "foo"
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const foo = gcp.serviceaccount.getS({
    prefix: "foo",
});
import pulumi
import pulumi_gcp as gcp
foo = gcp.serviceaccount.get_s(prefix="foo")
package main
import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/serviceaccount"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := serviceaccount.GetS(ctx, &serviceaccount.GetSArgs{
			Prefix: pulumi.StringRef("foo"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() => 
{
    var foo = Gcp.ServiceAccount.GetS.Invoke(new()
    {
        Prefix = "foo",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.serviceaccount.ServiceaccountFunctions;
import com.pulumi.gcp.serviceaccount.inputs.GetSArgs;
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 foo = ServiceaccountFunctions.getS(GetSArgs.builder()
            .prefix("foo")
            .build());
    }
}
variables:
  foo:
    fn::invoke:
      function: gcp:serviceaccount:getS
      arguments:
        prefix: foo
Get all service accounts that contain "bar"
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const bar = gcp.serviceaccount.getS({
    regex: ".*bar.*",
});
import pulumi
import pulumi_gcp as gcp
bar = gcp.serviceaccount.get_s(regex=".*bar.*")
package main
import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/serviceaccount"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := serviceaccount.GetS(ctx, &serviceaccount.GetSArgs{
			Regex: pulumi.StringRef(".*bar.*"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() => 
{
    var bar = Gcp.ServiceAccount.GetS.Invoke(new()
    {
        Regex = ".*bar.*",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.serviceaccount.ServiceaccountFunctions;
import com.pulumi.gcp.serviceaccount.inputs.GetSArgs;
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 bar = ServiceaccountFunctions.getS(GetSArgs.builder()
            .regex(".*bar.*")
            .build());
    }
}
variables:
  bar:
    fn::invoke:
      function: gcp:serviceaccount:getS
      arguments:
        regex: .*bar.*
Get all service accounts that are prefixed with "foo" and contain "bar"
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const fooBar = gcp.serviceaccount.getS({
    prefix: "foo",
    regex: ".*bar.*",
});
import pulumi
import pulumi_gcp as gcp
foo_bar = gcp.serviceaccount.get_s(prefix="foo",
    regex=".*bar.*")
package main
import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/serviceaccount"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := serviceaccount.GetS(ctx, &serviceaccount.GetSArgs{
			Prefix: pulumi.StringRef("foo"),
			Regex:  pulumi.StringRef(".*bar.*"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() => 
{
    var fooBar = Gcp.ServiceAccount.GetS.Invoke(new()
    {
        Prefix = "foo",
        Regex = ".*bar.*",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.serviceaccount.ServiceaccountFunctions;
import com.pulumi.gcp.serviceaccount.inputs.GetSArgs;
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 fooBar = ServiceaccountFunctions.getS(GetSArgs.builder()
            .prefix("foo")
            .regex(".*bar.*")
            .build());
    }
}
variables:
  fooBar:
    fn::invoke:
      function: gcp:serviceaccount:getS
      arguments:
        prefix: foo
        regex: .*bar.*
Using getS
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 getS(args: GetSArgs, opts?: InvokeOptions): Promise<GetSResult>
function getSOutput(args: GetSOutputArgs, opts?: InvokeOptions): Output<GetSResult>def get_s(prefix: Optional[str] = None,
          project: Optional[str] = None,
          regex: Optional[str] = None,
          opts: Optional[InvokeOptions] = None) -> GetSResult
def get_s_output(prefix: Optional[pulumi.Input[str]] = None,
          project: Optional[pulumi.Input[str]] = None,
          regex: Optional[pulumi.Input[str]] = None,
          opts: Optional[InvokeOptions] = None) -> Output[GetSResult]func GetS(ctx *Context, args *GetSArgs, opts ...InvokeOption) (*GetSResult, error)
func GetSOutput(ctx *Context, args *GetSOutputArgs, opts ...InvokeOption) GetSResultOutput> Note: This function is named GetS in the Go SDK.
public static class GetS 
{
    public static Task<GetSResult> InvokeAsync(GetSArgs args, InvokeOptions? opts = null)
    public static Output<GetSResult> Invoke(GetSInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetSResult> getS(GetSArgs args, InvokeOptions options)
public static Output<GetSResult> getS(GetSArgs args, InvokeOptions options)
fn::invoke:
  function: gcp:serviceaccount/getS:getS
  arguments:
    # arguments dictionaryThe following arguments are supported:
getS Result
The following output properties are available:
Supporting Types
GetSAccount 
- AccountId string
- The Google service account ID (the part before the @sign in theemail)
- Disabled bool
- Whether a service account is disabled or not.
- DisplayName string
- The display name for the service account.
- Email string
- The e-mail address of the service account. This value
should be referenced from any gcp.organizations.getIAMPolicydata sources that would grant the service account privileges.
- Member string
- The Identity of the service account in the form serviceAccount:{email}. This value is often used to refer to the service account in order to grant IAM permissions.
- Name string
- The fully-qualified name of the service account.
- UniqueId string
- The unique id of the service account.
- AccountId string
- The Google service account ID (the part before the @sign in theemail)
- Disabled bool
- Whether a service account is disabled or not.
- DisplayName string
- The display name for the service account.
- Email string
- The e-mail address of the service account. This value
should be referenced from any gcp.organizations.getIAMPolicydata sources that would grant the service account privileges.
- Member string
- The Identity of the service account in the form serviceAccount:{email}. This value is often used to refer to the service account in order to grant IAM permissions.
- Name string
- The fully-qualified name of the service account.
- UniqueId string
- The unique id of the service account.
- accountId String
- The Google service account ID (the part before the @sign in theemail)
- disabled Boolean
- Whether a service account is disabled or not.
- displayName String
- The display name for the service account.
- email String
- The e-mail address of the service account. This value
should be referenced from any gcp.organizations.getIAMPolicydata sources that would grant the service account privileges.
- member String
- The Identity of the service account in the form serviceAccount:{email}. This value is often used to refer to the service account in order to grant IAM permissions.
- name String
- The fully-qualified name of the service account.
- uniqueId String
- The unique id of the service account.
- accountId string
- The Google service account ID (the part before the @sign in theemail)
- disabled boolean
- Whether a service account is disabled or not.
- displayName string
- The display name for the service account.
- email string
- The e-mail address of the service account. This value
should be referenced from any gcp.organizations.getIAMPolicydata sources that would grant the service account privileges.
- member string
- The Identity of the service account in the form serviceAccount:{email}. This value is often used to refer to the service account in order to grant IAM permissions.
- name string
- The fully-qualified name of the service account.
- uniqueId string
- The unique id of the service account.
- account_id str
- The Google service account ID (the part before the @sign in theemail)
- disabled bool
- Whether a service account is disabled or not.
- display_name str
- The display name for the service account.
- email str
- The e-mail address of the service account. This value
should be referenced from any gcp.organizations.getIAMPolicydata sources that would grant the service account privileges.
- member str
- The Identity of the service account in the form serviceAccount:{email}. This value is often used to refer to the service account in order to grant IAM permissions.
- name str
- The fully-qualified name of the service account.
- unique_id str
- The unique id of the service account.
- accountId String
- The Google service account ID (the part before the @sign in theemail)
- disabled Boolean
- Whether a service account is disabled or not.
- displayName String
- The display name for the service account.
- email String
- The e-mail address of the service account. This value
should be referenced from any gcp.organizations.getIAMPolicydata sources that would grant the service account privileges.
- member String
- The Identity of the service account in the form serviceAccount:{email}. This value is often used to refer to the service account in order to grant IAM permissions.
- name String
- The fully-qualified name of the service account.
- uniqueId String
- The unique id of the service account.
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the google-betaTerraform Provider.