1. Packages
  2. Aptible Provider
  3. API Docs
  4. getStack
aptible 0.9.12 published on Monday, Apr 14, 2025 by aptible

aptible.getStack

Explore with Pulumi AI

aptible logo
aptible 0.9.12 published on Monday, Apr 14, 2025 by aptible

    # Stack Data Source

    Stacks are the underlying virtualized infrastructure (EC2 instances, private network, etc.) your resources are deployed on.

    Example Usage

    Determining the Stack ID

    If you have an Stack with the name “test-stack” you can create the data source:

    import * as pulumi from "@pulumi/pulumi";
    import * as aptible from "@pulumi/aptible";
    
    const test_stack = aptible.getStack({
        name: "test-stack",
    });
    
    import pulumi
    import pulumi_aptible as aptible
    
    test_stack = aptible.get_stack(name="test-stack")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/aptible/aptible"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := aptible.GetStack(ctx, &aptible.GetStackArgs{
    			Name: "test-stack",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aptible = Pulumi.Aptible;
    
    return await Deployment.RunAsync(() => 
    {
        var test_stack = Aptible.GetStack.Invoke(new()
        {
            Name = "test-stack",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aptible.AptibleFunctions;
    import com.pulumi.aptible.inputs.GetStackArgs;
    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 test-stack = AptibleFunctions.getStack(GetStackArgs.builder()
                .name("test-stack")
                .build());
    
        }
    }
    
    variables:
      test-stack:
        fn::invoke:
          function: aptible:getStack
          arguments:
            name: test-stack
    

    Once defined, you can use this data source in your resource definitions. For example, when defining an environment:

    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    resources:
      test-env:
        type: aptible:Environment
        properties:
          stackId: ${data.aptible_stack"test-stack"[%!s(MISSING)].stack_id}
          orgId: ${data.aptible_stack"test-stack"[%!s(MISSING)].org_id}
          name: test-env
    

    Note - If your environment is meant to be created on a dedicated stack you can omit the org_id field in the example above.

    Using getStack

    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 getStack(args: GetStackArgs, opts?: InvokeOptions): Promise<GetStackResult>
    function getStackOutput(args: GetStackOutputArgs, opts?: InvokeOptions): Output<GetStackResult>
    def get_stack(id: Optional[str] = None,
                  name: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetStackResult
    def get_stack_output(id: Optional[pulumi.Input[str]] = None,
                  name: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetStackResult]
    func GetStack(ctx *Context, args *GetStackArgs, opts ...InvokeOption) (*GetStackResult, error)
    func GetStackOutput(ctx *Context, args *GetStackOutputArgs, opts ...InvokeOption) GetStackResultOutput

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

    public static class GetStack 
    {
        public static Task<GetStackResult> InvokeAsync(GetStackArgs args, InvokeOptions? opts = null)
        public static Output<GetStackResult> Invoke(GetStackInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetStackResult> getStack(GetStackArgs args, InvokeOptions options)
    public static Output<GetStackResult> getStack(GetStackArgs args, InvokeOptions options)
    
    fn::invoke:
      function: aptible:index/getStack:getStack
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    The name of the Stack
    Id string
    Name string
    The name of the Stack
    Id string
    name String
    The name of the Stack
    id String
    name string
    The name of the Stack
    id string
    name str
    The name of the Stack
    id str
    name String
    The name of the Stack
    id String

    getStack Result

    The following output properties are available:

    Id string
    Name string
    OrgId string
    If the stack is a dedicated stack, you will also receive an id that corresponds to that organization. If it is a shared stack, this value will be empty.
    StackId double
    The unique ID for an Stack suitable for use in stack_id attributes
    Id string
    Name string
    OrgId string
    If the stack is a dedicated stack, you will also receive an id that corresponds to that organization. If it is a shared stack, this value will be empty.
    StackId float64
    The unique ID for an Stack suitable for use in stack_id attributes
    id String
    name String
    orgId String
    If the stack is a dedicated stack, you will also receive an id that corresponds to that organization. If it is a shared stack, this value will be empty.
    stackId Double
    The unique ID for an Stack suitable for use in stack_id attributes
    id string
    name string
    orgId string
    If the stack is a dedicated stack, you will also receive an id that corresponds to that organization. If it is a shared stack, this value will be empty.
    stackId number
    The unique ID for an Stack suitable for use in stack_id attributes
    id str
    name str
    org_id str
    If the stack is a dedicated stack, you will also receive an id that corresponds to that organization. If it is a shared stack, this value will be empty.
    stack_id float
    The unique ID for an Stack suitable for use in stack_id attributes
    id String
    name String
    orgId String
    If the stack is a dedicated stack, you will also receive an id that corresponds to that organization. If it is a shared stack, this value will be empty.
    stackId Number
    The unique ID for an Stack suitable for use in stack_id attributes

    Package Details

    Repository
    aptible aptible/terraform-provider-aptible
    License
    Notes
    This Pulumi package is based on the aptible Terraform Provider.
    aptible logo
    aptible 0.9.12 published on Monday, Apr 14, 2025 by aptible