1. Packages
  2. AWS Classic
  3. API Docs
  4. cloudformation
  5. getExport

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.13.0 published on Saturday, Dec 2, 2023 by Pulumi

aws.cloudformation.getExport

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.13.0 published on Saturday, Dec 2, 2023 by Pulumi

    The CloudFormation Export data source allows access to stack exports specified in the Output section of the Cloudformation Template using the optional Export Property.

    Note: If you are trying to use a value from a Cloudformation Stack in the same deployment please use normal interpolation or Cloudformation Outputs.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var subnetId = Aws.CloudFormation.GetExport.Invoke(new()
        {
            Name = "mySubnetIdExportName",
        });
    
        var web = new Aws.Ec2.Instance("web", new()
        {
            Ami = "ami-abb07bcb",
            InstanceType = "t2.micro",
            SubnetId = subnetId.Apply(getExportResult => getExportResult.Value),
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudformation"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		subnetId, err := cloudformation.GetExport(ctx, &cloudformation.GetExportArgs{
    			Name: "mySubnetIdExportName",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = ec2.NewInstance(ctx, "web", &ec2.InstanceArgs{
    			Ami:          pulumi.String("ami-abb07bcb"),
    			InstanceType: pulumi.String("t2.micro"),
    			SubnetId:     *pulumi.String(subnetId.Value),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.cloudformation.CloudformationFunctions;
    import com.pulumi.aws.cloudformation.inputs.GetExportArgs;
    import com.pulumi.aws.ec2.Instance;
    import com.pulumi.aws.ec2.InstanceArgs;
    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 subnetId = CloudformationFunctions.getExport(GetExportArgs.builder()
                .name("mySubnetIdExportName")
                .build());
    
            var web = new Instance("web", InstanceArgs.builder()        
                .ami("ami-abb07bcb")
                .instanceType("t2.micro")
                .subnetId(subnetId.applyValue(getExportResult -> getExportResult.value()))
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    subnet_id = aws.cloudformation.get_export(name="mySubnetIdExportName")
    web = aws.ec2.Instance("web",
        ami="ami-abb07bcb",
        instance_type="t2.micro",
        subnet_id=subnet_id.value)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const subnetId = aws.cloudformation.getExport({
        name: "mySubnetIdExportName",
    });
    const web = new aws.ec2.Instance("web", {
        ami: "ami-abb07bcb",
        instanceType: "t2.micro",
        subnetId: subnetId.then(subnetId => subnetId.value),
    });
    
    resources:
      web:
        type: aws:ec2:Instance
        properties:
          ami: ami-abb07bcb
          instanceType: t2.micro
          subnetId: ${subnetId.value}
    variables:
      subnetId:
        fn::invoke:
          Function: aws:cloudformation:getExport
          Arguments:
            name: mySubnetIdExportName
    

    Using getExport

    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 getExport(args: GetExportArgs, opts?: InvokeOptions): Promise<GetExportResult>
    function getExportOutput(args: GetExportOutputArgs, opts?: InvokeOptions): Output<GetExportResult>
    def get_export(name: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetExportResult
    def get_export_output(name: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetExportResult]
    func GetExport(ctx *Context, args *GetExportArgs, opts ...InvokeOption) (*GetExportResult, error)
    func GetExportOutput(ctx *Context, args *GetExportOutputArgs, opts ...InvokeOption) GetExportResultOutput

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

    public static class GetExport 
    {
        public static Task<GetExportResult> InvokeAsync(GetExportArgs args, InvokeOptions? opts = null)
        public static Output<GetExportResult> Invoke(GetExportInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetExportResult> getExport(GetExportArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:cloudformation/getExport:getExport
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string

    Name of the export as it appears in the console or from list-exports

    Name string

    Name of the export as it appears in the console or from list-exports

    name String

    Name of the export as it appears in the console or from list-exports

    name string

    Name of the export as it appears in the console or from list-exports

    name str

    Name of the export as it appears in the console or from list-exports

    name String

    Name of the export as it appears in the console or from list-exports

    getExport Result

    The following output properties are available:

    ExportingStackId string

    ARN of stack that contains the exported output name and value.

    Id string

    The provider-assigned unique ID for this managed resource.

    Name string
    Value string

    Value from Cloudformation export identified by the export name found from list-exports

    ExportingStackId string

    ARN of stack that contains the exported output name and value.

    Id string

    The provider-assigned unique ID for this managed resource.

    Name string
    Value string

    Value from Cloudformation export identified by the export name found from list-exports

    exportingStackId String

    ARN of stack that contains the exported output name and value.

    id String

    The provider-assigned unique ID for this managed resource.

    name String
    value String

    Value from Cloudformation export identified by the export name found from list-exports

    exportingStackId string

    ARN of stack that contains the exported output name and value.

    id string

    The provider-assigned unique ID for this managed resource.

    name string
    value string

    Value from Cloudformation export identified by the export name found from list-exports

    exporting_stack_id str

    ARN of stack that contains the exported output name and value.

    id str

    The provider-assigned unique ID for this managed resource.

    name str
    value str

    Value from Cloudformation export identified by the export name found from list-exports

    exportingStackId String

    ARN of stack that contains the exported output name and value.

    id String

    The provider-assigned unique ID for this managed resource.

    name String
    value String

    Value from Cloudformation export identified by the export name found from list-exports

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the aws Terraform Provider.

    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.13.0 published on Saturday, Dec 2, 2023 by Pulumi