AWS Classic
getExport
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 Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var subnetId = Output.Create(Aws.CloudFormation.GetExport.InvokeAsync(new Aws.CloudFormation.GetExportArgs
{
Name = "mySubnetIdExportName",
}));
var web = new Aws.Ec2.Instance("web", new Aws.Ec2.InstanceArgs
{
Ami = "ami-abb07bcb",
InstanceType = "t2.micro",
SubnetId = subnetId.Apply(subnetId => subnetId.Value),
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/cloudformation"
"github.com/pulumi/pulumi-aws/sdk/v5/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 java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var subnetId = Output.of(CloudformationFunctions.getExport(GetExportArgs.builder()
.name("mySubnetIdExportName")
.build()));
var web = new Instance("web", InstanceArgs.builder()
.ami("ami-abb07bcb")
.instanceType("t2.micro")
.subnetId(subnetId.apply(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
The name of the export as it appears in the console or from list-exports
- Name string
The name of the export as it appears in the console or from list-exports
- name String
The name of the export as it appears in the console or from list-exports
- name string
The name of the export as it appears in the console or from list-exports
- name str
The name of the export as it appears in the console or from list-exports
- name String
The name of the export as it appears in the console or from list-exports
getExport Result
The following output properties are available:
- Exporting
Stack stringId The exporting_stack_id (AWS ARNs) equivalent
ExportingStackId
from list-exports- Id string
The provider-assigned unique ID for this managed resource.
- Name string
- Value string
The value from Cloudformation export identified by the export name found from list-exports
- Exporting
Stack stringId The exporting_stack_id (AWS ARNs) equivalent
ExportingStackId
from list-exports- Id string
The provider-assigned unique ID for this managed resource.
- Name string
- Value string
The value from Cloudformation export identified by the export name found from list-exports
- exporting
Stack StringId The exporting_stack_id (AWS ARNs) equivalent
ExportingStackId
from list-exports- id String
The provider-assigned unique ID for this managed resource.
- name String
- value String
The value from Cloudformation export identified by the export name found from list-exports
- exporting
Stack stringId The exporting_stack_id (AWS ARNs) equivalent
ExportingStackId
from list-exports- id string
The provider-assigned unique ID for this managed resource.
- name string
- value string
The value from Cloudformation export identified by the export name found from list-exports
- exporting_
stack_ strid The exporting_stack_id (AWS ARNs) equivalent
ExportingStackId
from list-exports- id str
The provider-assigned unique ID for this managed resource.
- name str
- value str
The value from Cloudformation export identified by the export name found from list-exports
- exporting
Stack StringId The exporting_stack_id (AWS ARNs) equivalent
ExportingStackId
from list-exports- id String
The provider-assigned unique ID for this managed resource.
- name String
- value String
The value from Cloudformation export identified by the export name found from list-exports
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aws
Terraform Provider.