1. Packages
  2. Packages
  3. Confluent Provider
  4. API Docs
  5. getServiceAccount
Viewing docs for Confluent v0.1.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
confluentcloud logo
Viewing docs for Confluent v0.1.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    confluentcloud.ServiceAccount describes a Service Account data source.

    Example Usage

    using Pulumi;
    using ConfluentCloud = Pulumi.ConfluentCloud;
    
    class MyStack : Stack
    {
        public MyStack()
        {
            var exampleUsingIdServiceAccount = Output.Create(ConfluentCloud.GetServiceAccount.InvokeAsync(new ConfluentCloud.GetServiceAccountArgs
            {
                Id = "sa-abc123",
            }));
            this.ExampleUsingId = exampleUsingIdServiceAccount;
            var exampleUsingName = Output.Create(ConfluentCloud.GetServiceAccount.InvokeAsync(new ConfluentCloud.GetServiceAccountArgs
            {
                DisplayName = "test_sa",
            }));
            var test_env = new ConfluentCloud.Environment("test-env", new ConfluentCloud.EnvironmentArgs
            {
                DisplayName = exampleUsingIdServiceAccount.Apply(exampleUsingIdServiceAccount => $"env_for_{exampleUsingIdServiceAccount.DisplayName}"),
            });
        }
    
        [Output("exampleUsingId")]
        public Output<string> ExampleUsingId { get; set; }
    }
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-confluentcloud/sdk/go/confluentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleUsingIdServiceAccount, err := confluentcloud.LookupServiceAccount(ctx, &GetServiceAccountArgs{
    			Id: pulumi.StringRef("sa-abc123"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("exampleUsingId", exampleUsingIdServiceAccount)
    		_, err = confluentcloud.LookupServiceAccount(ctx, &GetServiceAccountArgs{
    			DisplayName: pulumi.StringRef("test_sa"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = confluentcloud.NewEnvironment(ctx, "test-env", &confluentcloud.EnvironmentArgs{
    			DisplayName: pulumi.String(fmt.Sprintf("%v%v", "env_for_", exampleUsingIdServiceAccount.DisplayName)),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import java.util.*;
    import java.io.*;
    import java.nio.*;
    import com.pulumi.*;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var exampleUsingIdServiceAccount = Output.of(ConfluentcloudFunctions.getServiceAccount(GetServiceAccountArgs.builder()
                .id("sa-abc123")
                .build()));
    
            ctx.export("exampleUsingId", exampleUsingIdServiceAccount.apply(getServiceAccountResult -> getServiceAccountResult));
            final var exampleUsingName = Output.of(ConfluentcloudFunctions.getServiceAccount(GetServiceAccountArgs.builder()
                .displayName("test_sa")
                .build()));
    
            var test_env = new Environment("test-env", EnvironmentArgs.builder()        
                .displayName(String.format("env_for_%s", exampleUsingIdServiceAccount.apply(getServiceAccountResult -> getServiceAccountResult.displayName())))
                .build());
    
        }
    }
    
    import * as pulumi from "@pulumi/pulumi";
    import * as confluentcloud from "@pulumi/confluentcloud";
    
    const exampleUsingIdServiceAccount = confluentcloud.getServiceAccount({
        id: "sa-abc123",
    });
    export const exampleUsingId = exampleUsingIdServiceAccount;
    const exampleUsingName = confluentcloud.getServiceAccount({
        displayName: "test_sa",
    });
    const test_env = new confluentcloud.Environment("test-env", {displayName: exampleUsingIdServiceAccount.then(exampleUsingIdServiceAccount => `env_for_${exampleUsingIdServiceAccount.displayName}`)});
    
    import pulumi
    import pulumi_confluentcloud as confluentcloud
    
    example_using_id_service_account = confluentcloud.get_service_account(id="sa-abc123")
    pulumi.export("exampleUsingId", example_using_id_service_account)
    example_using_name = confluentcloud.get_service_account(display_name="test_sa")
    test_env = confluentcloud.Environment("test-env", display_name=f"env_for_{example_using_id_service_account.display_name}")
    
    resources:
      test-env:
        type: confluentcloud:Environment
        properties:
          displayName: env_for_${exampleUsingIdServiceAccount.displayName}
    variables:
      exampleUsingIdServiceAccount:
        Fn::Invoke:
          Function: confluentcloud:getServiceAccount
          Arguments:
            id: sa-abc123
      exampleUsingName:
        Fn::Invoke:
          Function: confluentcloud:getServiceAccount
          Arguments:
            displayName: test_sa
    outputs:
      exampleUsingId: ${exampleUsingIdServiceAccount}
    

    Using getServiceAccount

    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 getServiceAccount(args: GetServiceAccountArgs, opts?: InvokeOptions): Promise<GetServiceAccountResult>
    function getServiceAccountOutput(args: GetServiceAccountOutputArgs, opts?: InvokeOptions): Output<GetServiceAccountResult>
    def get_service_account(display_name: Optional[str] = None,
                            id: Optional[str] = None,
                            opts: Optional[InvokeOptions] = None) -> GetServiceAccountResult
    def get_service_account_output(display_name: Optional[pulumi.Input[str]] = None,
                            id: Optional[pulumi.Input[str]] = None,
                            opts: Optional[InvokeOptions] = None) -> Output[GetServiceAccountResult]
    func LookupServiceAccount(ctx *Context, args *LookupServiceAccountArgs, opts ...InvokeOption) (*LookupServiceAccountResult, error)
    func LookupServiceAccountOutput(ctx *Context, args *LookupServiceAccountOutputArgs, opts ...InvokeOption) LookupServiceAccountResultOutput

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

    public static class GetServiceAccount 
    {
        public static Task<GetServiceAccountResult> InvokeAsync(GetServiceAccountArgs args, InvokeOptions? opts = null)
        public static Output<GetServiceAccountResult> Invoke(GetServiceAccountInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetServiceAccountResult> getServiceAccount(GetServiceAccountArgs args, InvokeOptions options)
    public static Output<GetServiceAccountResult> getServiceAccount(GetServiceAccountArgs args, InvokeOptions options)
    
    fn::invoke:
      function: confluentcloud:index/getServiceAccount:getServiceAccount
      arguments:
        # arguments dictionary

    The following arguments are supported:

    DisplayName string
    A human-readable name for the Service Account.
    Id string
    The ID of the Service Account (e.g., sa-abc123).
    DisplayName string
    A human-readable name for the Service Account.
    Id string
    The ID of the Service Account (e.g., sa-abc123).
    displayName String
    A human-readable name for the Service Account.
    id String
    The ID of the Service Account (e.g., sa-abc123).
    displayName string
    A human-readable name for the Service Account.
    id string
    The ID of the Service Account (e.g., sa-abc123).
    display_name str
    A human-readable name for the Service Account.
    id str
    The ID of the Service Account (e.g., sa-abc123).
    displayName String
    A human-readable name for the Service Account.
    id String
    The ID of the Service Account (e.g., sa-abc123).

    getServiceAccount Result

    The following output properties are available:

    ApiVersion string
    (Required String) An API Version of the schema version of the Service Account.
    Description string
    (Required String) A free-form description of the Service Account.
    DisplayName string
    (Required String) A human-readable name for the Service Account.
    Id string
    (Required String) The ID of the Service Account (e.g., sa-abc123).
    Kind string
    (Required String) A kind of the Service Account.
    ApiVersion string
    (Required String) An API Version of the schema version of the Service Account.
    Description string
    (Required String) A free-form description of the Service Account.
    DisplayName string
    (Required String) A human-readable name for the Service Account.
    Id string
    (Required String) The ID of the Service Account (e.g., sa-abc123).
    Kind string
    (Required String) A kind of the Service Account.
    apiVersion String
    (Required String) An API Version of the schema version of the Service Account.
    description String
    (Required String) A free-form description of the Service Account.
    displayName String
    (Required String) A human-readable name for the Service Account.
    id String
    (Required String) The ID of the Service Account (e.g., sa-abc123).
    kind String
    (Required String) A kind of the Service Account.
    apiVersion string
    (Required String) An API Version of the schema version of the Service Account.
    description string
    (Required String) A free-form description of the Service Account.
    displayName string
    (Required String) A human-readable name for the Service Account.
    id string
    (Required String) The ID of the Service Account (e.g., sa-abc123).
    kind string
    (Required String) A kind of the Service Account.
    api_version str
    (Required String) An API Version of the schema version of the Service Account.
    description str
    (Required String) A free-form description of the Service Account.
    display_name str
    (Required String) A human-readable name for the Service Account.
    id str
    (Required String) The ID of the Service Account (e.g., sa-abc123).
    kind str
    (Required String) A kind of the Service Account.
    apiVersion String
    (Required String) An API Version of the schema version of the Service Account.
    description String
    (Required String) A free-form description of the Service Account.
    displayName String
    (Required String) A human-readable name for the Service Account.
    id String
    (Required String) The ID of the Service Account (e.g., sa-abc123).
    kind String
    (Required String) A kind of the Service Account.

    Package Details

    Repository
    Confluent Cloud pulumi/pulumi-confluentcloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the confluent Terraform Provider.
    confluentcloud logo
    Viewing docs for Confluent v0.1.0 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.