1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. getDefaultServiceAccount
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

gcp.compute.getDefaultServiceAccount

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

    Use this data source to retrieve default service account for this project

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const default = gcp.compute.getDefaultServiceAccount({});
    export const defaultAccount = _default.then(_default => _default.email);
    
    import pulumi
    import pulumi_gcp as gcp
    
    default = gcp.compute.get_default_service_account()
    pulumi.export("defaultAccount", default.email)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_default, err := compute.GetDefaultServiceAccount(ctx, &compute.GetDefaultServiceAccountArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("defaultAccount", _default.Email)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = Gcp.Compute.GetDefaultServiceAccount.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["defaultAccount"] = @default.Apply(@default => @default.Apply(getDefaultServiceAccountResult => getDefaultServiceAccountResult.Email)),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.ComputeFunctions;
    import com.pulumi.gcp.compute.inputs.GetDefaultServiceAccountArgs;
    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 default = ComputeFunctions.getDefaultServiceAccount();
    
            ctx.export("defaultAccount", default_.email());
        }
    }
    
    variables:
      default:
        fn::invoke:
          Function: gcp:compute:getDefaultServiceAccount
          Arguments: {}
    outputs:
      defaultAccount: ${default.email}
    

    Using getDefaultServiceAccount

    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 getDefaultServiceAccount(args: GetDefaultServiceAccountArgs, opts?: InvokeOptions): Promise<GetDefaultServiceAccountResult>
    function getDefaultServiceAccountOutput(args: GetDefaultServiceAccountOutputArgs, opts?: InvokeOptions): Output<GetDefaultServiceAccountResult>
    def get_default_service_account(project: Optional[str] = None,
                                    opts: Optional[InvokeOptions] = None) -> GetDefaultServiceAccountResult
    def get_default_service_account_output(project: Optional[pulumi.Input[str]] = None,
                                    opts: Optional[InvokeOptions] = None) -> Output[GetDefaultServiceAccountResult]
    func GetDefaultServiceAccount(ctx *Context, args *GetDefaultServiceAccountArgs, opts ...InvokeOption) (*GetDefaultServiceAccountResult, error)
    func GetDefaultServiceAccountOutput(ctx *Context, args *GetDefaultServiceAccountOutputArgs, opts ...InvokeOption) GetDefaultServiceAccountResultOutput

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

    public static class GetDefaultServiceAccount 
    {
        public static Task<GetDefaultServiceAccountResult> InvokeAsync(GetDefaultServiceAccountArgs args, InvokeOptions? opts = null)
        public static Output<GetDefaultServiceAccountResult> Invoke(GetDefaultServiceAccountInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetDefaultServiceAccountResult> getDefaultServiceAccount(GetDefaultServiceAccountArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: gcp:compute/getDefaultServiceAccount:getDefaultServiceAccount
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Project string
    The project ID. If it is not provided, the provider project is used.
    Project string
    The project ID. If it is not provided, the provider project is used.
    project String
    The project ID. If it is not provided, the provider project is used.
    project string
    The project ID. If it is not provided, the provider project is used.
    project str
    The project ID. If it is not provided, the provider project is used.
    project String
    The project ID. If it is not provided, the provider project is used.

    getDefaultServiceAccount Result

    The following output properties are available:

    DisplayName string
    The display name for the service account.
    Email string
    Email address of the default service account used by VMs running in this project
    Id string
    The provider-assigned unique ID for this managed resource.
    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.
    Project string
    UniqueId string
    The unique id of the service account.
    DisplayName string
    The display name for the service account.
    Email string
    Email address of the default service account used by VMs running in this project
    Id string
    The provider-assigned unique ID for this managed resource.
    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.
    Project string
    UniqueId string
    The unique id of the service account.
    displayName String
    The display name for the service account.
    email String
    Email address of the default service account used by VMs running in this project
    id String
    The provider-assigned unique ID for this managed resource.
    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.
    project String
    uniqueId String
    The unique id of the service account.
    displayName string
    The display name for the service account.
    email string
    Email address of the default service account used by VMs running in this project
    id string
    The provider-assigned unique ID for this managed resource.
    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.
    project string
    uniqueId string
    The unique id of the service account.
    display_name str
    The display name for the service account.
    email str
    Email address of the default service account used by VMs running in this project
    id str
    The provider-assigned unique ID for this managed resource.
    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.
    project str
    unique_id str
    The unique id of the service account.
    displayName String
    The display name for the service account.
    email String
    Email address of the default service account used by VMs running in this project
    id String
    The provider-assigned unique ID for this managed resource.
    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.
    project String
    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-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi