github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudformation/getExport.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package cloudformation 5 6 import ( 7 "context" 8 "reflect" 9 10 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // The CloudFormation Export data source allows access to stack 15 // exports specified in the [Output](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html) section of the Cloudformation Template using the optional Export Property. 16 // 17 // > Note: If you are trying to use a value from a Cloudformation Stack in the same deployment please use normal interpolation or Cloudformation Outputs. 18 // 19 // ## Example Usage 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudformation" 28 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 29 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 30 // 31 // ) 32 // 33 // func main() { 34 // pulumi.Run(func(ctx *pulumi.Context) error { 35 // subnetId, err := cloudformation.GetExport(ctx, &cloudformation.GetExportArgs{ 36 // Name: "mySubnetIdExportName", 37 // }, nil) 38 // if err != nil { 39 // return err 40 // } 41 // _, err = ec2.NewInstance(ctx, "web", &ec2.InstanceArgs{ 42 // Ami: pulumi.String("ami-abb07bcb"), 43 // InstanceType: pulumi.String(ec2.InstanceType_T2_Micro), 44 // SubnetId: pulumi.String(subnetId.Value), 45 // }) 46 // if err != nil { 47 // return err 48 // } 49 // return nil 50 // }) 51 // } 52 // 53 // ``` 54 // <!--End PulumiCodeChooser --> 55 func GetExport(ctx *pulumi.Context, args *GetExportArgs, opts ...pulumi.InvokeOption) (*GetExportResult, error) { 56 opts = internal.PkgInvokeDefaultOpts(opts) 57 var rv GetExportResult 58 err := ctx.Invoke("aws:cloudformation/getExport:getExport", args, &rv, opts...) 59 if err != nil { 60 return nil, err 61 } 62 return &rv, nil 63 } 64 65 // A collection of arguments for invoking getExport. 66 type GetExportArgs struct { 67 // Name of the export as it appears in the console or from [list-exports](http://docs.aws.amazon.com/cli/latest/reference/cloudformation/list-exports.html) 68 Name string `pulumi:"name"` 69 } 70 71 // A collection of values returned by getExport. 72 type GetExportResult struct { 73 // ARN of stack that contains the exported output name and value. 74 ExportingStackId string `pulumi:"exportingStackId"` 75 // The provider-assigned unique ID for this managed resource. 76 Id string `pulumi:"id"` 77 Name string `pulumi:"name"` 78 // Value from Cloudformation export identified by the export name found from [list-exports](http://docs.aws.amazon.com/cli/latest/reference/cloudformation/list-exports.html) 79 Value string `pulumi:"value"` 80 } 81 82 func GetExportOutput(ctx *pulumi.Context, args GetExportOutputArgs, opts ...pulumi.InvokeOption) GetExportResultOutput { 83 return pulumi.ToOutputWithContext(context.Background(), args). 84 ApplyT(func(v interface{}) (GetExportResult, error) { 85 args := v.(GetExportArgs) 86 r, err := GetExport(ctx, &args, opts...) 87 var s GetExportResult 88 if r != nil { 89 s = *r 90 } 91 return s, err 92 }).(GetExportResultOutput) 93 } 94 95 // A collection of arguments for invoking getExport. 96 type GetExportOutputArgs struct { 97 // Name of the export as it appears in the console or from [list-exports](http://docs.aws.amazon.com/cli/latest/reference/cloudformation/list-exports.html) 98 Name pulumi.StringInput `pulumi:"name"` 99 } 100 101 func (GetExportOutputArgs) ElementType() reflect.Type { 102 return reflect.TypeOf((*GetExportArgs)(nil)).Elem() 103 } 104 105 // A collection of values returned by getExport. 106 type GetExportResultOutput struct{ *pulumi.OutputState } 107 108 func (GetExportResultOutput) ElementType() reflect.Type { 109 return reflect.TypeOf((*GetExportResult)(nil)).Elem() 110 } 111 112 func (o GetExportResultOutput) ToGetExportResultOutput() GetExportResultOutput { 113 return o 114 } 115 116 func (o GetExportResultOutput) ToGetExportResultOutputWithContext(ctx context.Context) GetExportResultOutput { 117 return o 118 } 119 120 // ARN of stack that contains the exported output name and value. 121 func (o GetExportResultOutput) ExportingStackId() pulumi.StringOutput { 122 return o.ApplyT(func(v GetExportResult) string { return v.ExportingStackId }).(pulumi.StringOutput) 123 } 124 125 // The provider-assigned unique ID for this managed resource. 126 func (o GetExportResultOutput) Id() pulumi.StringOutput { 127 return o.ApplyT(func(v GetExportResult) string { return v.Id }).(pulumi.StringOutput) 128 } 129 130 func (o GetExportResultOutput) Name() pulumi.StringOutput { 131 return o.ApplyT(func(v GetExportResult) string { return v.Name }).(pulumi.StringOutput) 132 } 133 134 // Value from Cloudformation export identified by the export name found from [list-exports](http://docs.aws.amazon.com/cli/latest/reference/cloudformation/list-exports.html) 135 func (o GetExportResultOutput) Value() pulumi.StringOutput { 136 return o.ApplyT(func(v GetExportResult) string { return v.Value }).(pulumi.StringOutput) 137 } 138 139 func init() { 140 pulumi.RegisterOutputType(GetExportResultOutput{}) 141 }