1. Packages
  2. Confluent Provider
  3. API Docs
  4. getServiceAccount
Confluent v2.10.0 published on Wednesday, Nov 20, 2024 by Pulumi

confluentcloud.getServiceAccount

Explore with Pulumi AI

confluentcloud logo
Confluent v2.10.0 published on Wednesday, Nov 20, 2024 by Pulumi

    General Availability

    confluentcloud.ServiceAccount describes a Service Account data source.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as confluentcloud from "@pulumi/confluentcloud";
    
    export = async () => {
        const exampleUsingId = await confluentcloud.getServiceAccount({
            id: "sa-abc123",
        });
        const exampleUsingName = await confluentcloud.getServiceAccount({
            displayName: "test_sa",
        });
        const test_env = new confluentcloud.Environment("test-env", {displayName: `env_for_${exampleUsingId.displayName}`});
        return {
            exampleUsingId: exampleUsingId,
        };
    }
    
    import pulumi
    import pulumi_confluentcloud as confluentcloud
    
    example_using_id = confluentcloud.get_service_account(id="sa-abc123")
    pulumi.export("exampleUsingId", example_using_id)
    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.display_name}")
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-confluentcloud/sdk/v2/go/confluentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleUsingId, err := confluentcloud.LookupServiceAccount(ctx, &confluentcloud.LookupServiceAccountArgs{
    			Id: pulumi.StringRef("sa-abc123"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("exampleUsingId", exampleUsingId)
    		_, err = confluentcloud.LookupServiceAccount(ctx, &confluentcloud.LookupServiceAccountArgs{
    			DisplayName: pulumi.StringRef("test_sa"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = confluentcloud.NewEnvironment(ctx, "test-env", &confluentcloud.EnvironmentArgs{
    			DisplayName: pulumi.Sprintf("env_for_%v", exampleUsingId.DisplayName),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using ConfluentCloud = Pulumi.ConfluentCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleUsingId = ConfluentCloud.GetServiceAccount.Invoke(new()
        {
            Id = "sa-abc123",
        });
    
        var exampleUsingName = ConfluentCloud.GetServiceAccount.Invoke(new()
        {
            DisplayName = "test_sa",
        });
    
        var test_env = new ConfluentCloud.Environment("test-env", new()
        {
            DisplayName = $"env_for_{exampleUsingId.Apply(getServiceAccountResult => getServiceAccountResult.DisplayName)}",
        });
    
        return new Dictionary<string, object?>
        {
            ["exampleUsingId"] = exampleUsingId,
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.confluentcloud.ConfluentcloudFunctions;
    import com.pulumi.confluentcloud.inputs.GetServiceAccountArgs;
    import com.pulumi.confluentcloud.Environment;
    import com.pulumi.confluentcloud.EnvironmentArgs;
    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 exampleUsingId = ConfluentcloudFunctions.getServiceAccount(GetServiceAccountArgs.builder()
                .id("sa-abc123")
                .build());
    
            ctx.export("exampleUsingId", exampleUsingId.applyValue(getServiceAccountResult -> getServiceAccountResult));
            final var exampleUsingName = ConfluentcloudFunctions.getServiceAccount(GetServiceAccountArgs.builder()
                .displayName("test_sa")
                .build());
    
            var test_env = new Environment("test-env", EnvironmentArgs.builder()
                .displayName(String.format("env_for_%s", exampleUsingId.applyValue(getServiceAccountResult -> getServiceAccountResult.displayName())))
                .build());
    
        }
    }
    
    resources:
      test-env:
        type: confluentcloud:Environment
        properties:
          displayName: env_for_${exampleUsingId.displayName}
    variables:
      exampleUsingId:
        fn::invoke:
          Function: confluentcloud:getServiceAccount
          Arguments:
            id: sa-abc123
      exampleUsingName:
        fn::invoke:
          Function: confluentcloud:getServiceAccount
          Arguments:
            displayName: test_sa
    outputs:
      exampleUsingId: ${exampleUsingId}
    

    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)
    // Output-based functions aren't available in Java yet
    
    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. Limited to 64 characters in length.

    Note: Exactly one from the id and display_name attributes must be specified.

    Id string
    The ID of the Service Account (e.g., sa-abc123).
    DisplayName string

    A human-readable name for the Service Account. Limited to 64 characters in length.

    Note: Exactly one from the id and display_name attributes must be specified.

    Id string
    The ID of the Service Account (e.g., sa-abc123).
    displayName String

    A human-readable name for the Service Account. Limited to 64 characters in length.

    Note: Exactly one from the id and display_name attributes must be specified.

    id String
    The ID of the Service Account (e.g., sa-abc123).
    displayName string

    A human-readable name for the Service Account. Limited to 64 characters in length.

    Note: Exactly one from the id and display_name attributes must be specified.

    id string
    The ID of the Service Account (e.g., sa-abc123).
    display_name str

    A human-readable name for the Service Account. Limited to 64 characters in length.

    Note: Exactly one from the id and display_name attributes must be specified.

    id str
    The ID of the Service Account (e.g., sa-abc123).
    displayName String

    A human-readable name for the Service Account. Limited to 64 characters in length.

    Note: Exactly one from the id and display_name attributes must be specified.

    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. Limited to 64 characters in length.
    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. Limited to 64 characters in length.
    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. Limited to 64 characters in length.
    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. Limited to 64 characters in length.
    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. Limited to 64 characters in length.
    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. Limited to 64 characters in length.
    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
    Confluent v2.10.0 published on Wednesday, Nov 20, 2024 by Pulumi