1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. getAccount
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

alicloud.getAccount

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

    This data source provides information about the current account.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const current = alicloud.getAccount({});
    export const currentAccountId = current.then(current => current.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    current = alicloud.get_account()
    pulumi.export("currentAccountId", current.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		current, err := alicloud.GetAccount(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("currentAccountId", current.Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var current = AliCloud.GetAccount.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["currentAccountId"] = current.Apply(getAccountResult => getAccountResult.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.AlicloudFunctions;
    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 current = AlicloudFunctions.getAccount();
    
            ctx.export("currentAccountId", current.applyValue(getAccountResult -> getAccountResult.id()));
        }
    }
    
    variables:
      current:
        fn::invoke:
          Function: alicloud:getAccount
          Arguments: {}
    outputs:
      currentAccountId: ${current.id}
    

    Using getAccount

    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 getAccount(opts?: InvokeOptions): Promise<GetAccountResult>
    function getAccountOutput(opts?: InvokeOptions): Output<GetAccountResult>
    def get_account(opts: Optional[InvokeOptions] = None) -> GetAccountResult
    def get_account_output(opts: Optional[InvokeOptions] = None) -> Output[GetAccountResult]
    func GetAccount(ctx *Context, opts ...InvokeOption) (*GetAccountResult, error)
    func GetAccountOutput(ctx *Context, opts ...InvokeOption) GetAccountResultOutput

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

    public static class GetAccount 
    {
        public static Task<GetAccountResult> InvokeAsync(InvokeOptions? opts = null)
        public static Output<GetAccountResult> Invoke(InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetAccountResult> getAccount(InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:index/getAccount:getAccount
      arguments:
        # arguments dictionary

    getAccount Result

    The following output properties are available:

    Id string
    Account ID (e.g. "1239306421830812"). It can be used to construct an ARN.
    Id string
    Account ID (e.g. "1239306421830812"). It can be used to construct an ARN.
    id String
    Account ID (e.g. "1239306421830812"). It can be used to construct an ARN.
    id string
    Account ID (e.g. "1239306421830812"). It can be used to construct an ARN.
    id str
    Account ID (e.g. "1239306421830812"). It can be used to construct an ARN.
    id String
    Account ID (e.g. "1239306421830812"). It can be used to construct an ARN.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi