github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudformation/getStack.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 Stack data source allows access to stack
    15  // outputs and other useful data including the template body.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudformation"
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			network, err := cloudformation.LookupStack(ctx, &cloudformation.LookupStackArgs{
    34  //				Name: "my-network-stack",
    35  //			}, nil)
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			_, err = ec2.NewInstance(ctx, "web", &ec2.InstanceArgs{
    40  //				Ami:          pulumi.String("ami-abb07bcb"),
    41  //				InstanceType: pulumi.String(ec2.InstanceType_T2_Micro),
    42  //				SubnetId:     pulumi.String(network.Outputs.SubnetId),
    43  //				Tags: pulumi.StringMap{
    44  //					"Name": pulumi.String("HelloWorld"),
    45  //				},
    46  //			})
    47  //			if err != nil {
    48  //				return err
    49  //			}
    50  //			return nil
    51  //		})
    52  //	}
    53  //
    54  // ```
    55  // <!--End PulumiCodeChooser -->
    56  func LookupStack(ctx *pulumi.Context, args *LookupStackArgs, opts ...pulumi.InvokeOption) (*LookupStackResult, error) {
    57  	opts = internal.PkgInvokeDefaultOpts(opts)
    58  	var rv LookupStackResult
    59  	err := ctx.Invoke("aws:cloudformation/getStack:getStack", args, &rv, opts...)
    60  	if err != nil {
    61  		return nil, err
    62  	}
    63  	return &rv, nil
    64  }
    65  
    66  // A collection of arguments for invoking getStack.
    67  type LookupStackArgs struct {
    68  	// Name of the stack
    69  	Name string `pulumi:"name"`
    70  	// Map of tags associated with this stack.
    71  	Tags map[string]string `pulumi:"tags"`
    72  }
    73  
    74  // A collection of values returned by getStack.
    75  type LookupStackResult struct {
    76  	// List of capabilities
    77  	Capabilities []string `pulumi:"capabilities"`
    78  	// Description of the stack
    79  	Description string `pulumi:"description"`
    80  	// Whether the rollback of the stack is disabled when stack creation fails
    81  	DisableRollback bool `pulumi:"disableRollback"`
    82  	// ARN of the IAM role used to create the stack.
    83  	IamRoleArn string `pulumi:"iamRoleArn"`
    84  	// The provider-assigned unique ID for this managed resource.
    85  	Id   string `pulumi:"id"`
    86  	Name string `pulumi:"name"`
    87  	// List of SNS topic ARNs to publish stack related events
    88  	NotificationArns []string `pulumi:"notificationArns"`
    89  	// Map of outputs from the stack.
    90  	Outputs map[string]string `pulumi:"outputs"`
    91  	// Map of parameters that specify input parameters for the stack.
    92  	Parameters map[string]string `pulumi:"parameters"`
    93  	// Map of tags associated with this stack.
    94  	Tags map[string]string `pulumi:"tags"`
    95  	// Structure containing the template body.
    96  	TemplateBody string `pulumi:"templateBody"`
    97  	// Amount of time that can pass before the stack status becomes `CREATE_FAILED`
    98  	TimeoutInMinutes int `pulumi:"timeoutInMinutes"`
    99  }
   100  
   101  func LookupStackOutput(ctx *pulumi.Context, args LookupStackOutputArgs, opts ...pulumi.InvokeOption) LookupStackResultOutput {
   102  	return pulumi.ToOutputWithContext(context.Background(), args).
   103  		ApplyT(func(v interface{}) (LookupStackResult, error) {
   104  			args := v.(LookupStackArgs)
   105  			r, err := LookupStack(ctx, &args, opts...)
   106  			var s LookupStackResult
   107  			if r != nil {
   108  				s = *r
   109  			}
   110  			return s, err
   111  		}).(LookupStackResultOutput)
   112  }
   113  
   114  // A collection of arguments for invoking getStack.
   115  type LookupStackOutputArgs struct {
   116  	// Name of the stack
   117  	Name pulumi.StringInput `pulumi:"name"`
   118  	// Map of tags associated with this stack.
   119  	Tags pulumi.StringMapInput `pulumi:"tags"`
   120  }
   121  
   122  func (LookupStackOutputArgs) ElementType() reflect.Type {
   123  	return reflect.TypeOf((*LookupStackArgs)(nil)).Elem()
   124  }
   125  
   126  // A collection of values returned by getStack.
   127  type LookupStackResultOutput struct{ *pulumi.OutputState }
   128  
   129  func (LookupStackResultOutput) ElementType() reflect.Type {
   130  	return reflect.TypeOf((*LookupStackResult)(nil)).Elem()
   131  }
   132  
   133  func (o LookupStackResultOutput) ToLookupStackResultOutput() LookupStackResultOutput {
   134  	return o
   135  }
   136  
   137  func (o LookupStackResultOutput) ToLookupStackResultOutputWithContext(ctx context.Context) LookupStackResultOutput {
   138  	return o
   139  }
   140  
   141  // List of capabilities
   142  func (o LookupStackResultOutput) Capabilities() pulumi.StringArrayOutput {
   143  	return o.ApplyT(func(v LookupStackResult) []string { return v.Capabilities }).(pulumi.StringArrayOutput)
   144  }
   145  
   146  // Description of the stack
   147  func (o LookupStackResultOutput) Description() pulumi.StringOutput {
   148  	return o.ApplyT(func(v LookupStackResult) string { return v.Description }).(pulumi.StringOutput)
   149  }
   150  
   151  // Whether the rollback of the stack is disabled when stack creation fails
   152  func (o LookupStackResultOutput) DisableRollback() pulumi.BoolOutput {
   153  	return o.ApplyT(func(v LookupStackResult) bool { return v.DisableRollback }).(pulumi.BoolOutput)
   154  }
   155  
   156  // ARN of the IAM role used to create the stack.
   157  func (o LookupStackResultOutput) IamRoleArn() pulumi.StringOutput {
   158  	return o.ApplyT(func(v LookupStackResult) string { return v.IamRoleArn }).(pulumi.StringOutput)
   159  }
   160  
   161  // The provider-assigned unique ID for this managed resource.
   162  func (o LookupStackResultOutput) Id() pulumi.StringOutput {
   163  	return o.ApplyT(func(v LookupStackResult) string { return v.Id }).(pulumi.StringOutput)
   164  }
   165  
   166  func (o LookupStackResultOutput) Name() pulumi.StringOutput {
   167  	return o.ApplyT(func(v LookupStackResult) string { return v.Name }).(pulumi.StringOutput)
   168  }
   169  
   170  // List of SNS topic ARNs to publish stack related events
   171  func (o LookupStackResultOutput) NotificationArns() pulumi.StringArrayOutput {
   172  	return o.ApplyT(func(v LookupStackResult) []string { return v.NotificationArns }).(pulumi.StringArrayOutput)
   173  }
   174  
   175  // Map of outputs from the stack.
   176  func (o LookupStackResultOutput) Outputs() pulumi.StringMapOutput {
   177  	return o.ApplyT(func(v LookupStackResult) map[string]string { return v.Outputs }).(pulumi.StringMapOutput)
   178  }
   179  
   180  // Map of parameters that specify input parameters for the stack.
   181  func (o LookupStackResultOutput) Parameters() pulumi.StringMapOutput {
   182  	return o.ApplyT(func(v LookupStackResult) map[string]string { return v.Parameters }).(pulumi.StringMapOutput)
   183  }
   184  
   185  // Map of tags associated with this stack.
   186  func (o LookupStackResultOutput) Tags() pulumi.StringMapOutput {
   187  	return o.ApplyT(func(v LookupStackResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   188  }
   189  
   190  // Structure containing the template body.
   191  func (o LookupStackResultOutput) TemplateBody() pulumi.StringOutput {
   192  	return o.ApplyT(func(v LookupStackResult) string { return v.TemplateBody }).(pulumi.StringOutput)
   193  }
   194  
   195  // Amount of time that can pass before the stack status becomes `CREATE_FAILED`
   196  func (o LookupStackResultOutput) TimeoutInMinutes() pulumi.IntOutput {
   197  	return o.ApplyT(func(v LookupStackResult) int { return v.TimeoutInMinutes }).(pulumi.IntOutput)
   198  }
   199  
   200  func init() {
   201  	pulumi.RegisterOutputType(LookupStackResultOutput{})
   202  }