github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/serverlessrepository/cloudFormationStack.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 serverlessrepository
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Deploys an Application CloudFormation Stack from the Serverless Application Repository.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"fmt"
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
    28  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/serverlessrepository"
    29  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    30  //
    31  // )
    32  //
    33  //	func main() {
    34  //		pulumi.Run(func(ctx *pulumi.Context) error {
    35  //			current, err := aws.GetPartition(ctx, nil, nil)
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			currentGetRegion, err := aws.GetRegion(ctx, nil, nil)
    40  //			if err != nil {
    41  //				return err
    42  //			}
    43  //			_, err = serverlessrepository.NewCloudFormationStack(ctx, "postgres-rotator", &serverlessrepository.CloudFormationStackArgs{
    44  //				Name:          pulumi.String("postgres-rotator"),
    45  //				ApplicationId: pulumi.String("arn:aws:serverlessrepo:us-east-1:297356227824:applications/SecretsManagerRDSPostgreSQLRotationSingleUser"),
    46  //				Capabilities: pulumi.StringArray{
    47  //					pulumi.String("CAPABILITY_IAM"),
    48  //					pulumi.String("CAPABILITY_RESOURCE_POLICY"),
    49  //				},
    50  //				Parameters: pulumi.StringMap{
    51  //					"functionName": pulumi.String("func-postgres-rotator"),
    52  //					"endpoint":     pulumi.String(fmt.Sprintf("secretsmanager.%v.%v", currentGetRegion.Name, current.DnsSuffix)),
    53  //				},
    54  //			})
    55  //			if err != nil {
    56  //				return err
    57  //			}
    58  //			return nil
    59  //		})
    60  //	}
    61  //
    62  // ```
    63  // <!--End PulumiCodeChooser -->
    64  //
    65  // ## Import
    66  //
    67  // Using `pulumi import`, import Serverless Application Repository Stack using the CloudFormation Stack name (with or without the `serverlessrepo-` prefix) or the CloudFormation Stack ID. For example:
    68  //
    69  // ```sh
    70  // $ pulumi import aws:serverlessrepository/cloudFormationStack:CloudFormationStack example serverlessrepo-postgres-rotator
    71  // ```
    72  type CloudFormationStack struct {
    73  	pulumi.CustomResourceState
    74  
    75  	// The ARN of the application from the Serverless Application Repository.
    76  	ApplicationId pulumi.StringOutput `pulumi:"applicationId"`
    77  	// A list of capabilities. Valid values are `CAPABILITY_IAM`, `CAPABILITY_NAMED_IAM`, `CAPABILITY_RESOURCE_POLICY`, or `CAPABILITY_AUTO_EXPAND`
    78  	Capabilities pulumi.StringArrayOutput `pulumi:"capabilities"`
    79  	// The name of the stack to create. The resource deployed in AWS will be prefixed with `serverlessrepo-`
    80  	Name pulumi.StringOutput `pulumi:"name"`
    81  	// A map of outputs from the stack.
    82  	Outputs pulumi.StringMapOutput `pulumi:"outputs"`
    83  	// A map of Parameter structures that specify input parameters for the stack.
    84  	Parameters pulumi.StringMapOutput `pulumi:"parameters"`
    85  	// The version of the application to deploy. If not supplied, deploys the latest version.
    86  	SemanticVersion pulumi.StringOutput `pulumi:"semanticVersion"`
    87  	// A list of tags to associate with this stack. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    88  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    89  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    90  	//
    91  	// Deprecated: Please use `tags` instead.
    92  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    93  }
    94  
    95  // NewCloudFormationStack registers a new resource with the given unique name, arguments, and options.
    96  func NewCloudFormationStack(ctx *pulumi.Context,
    97  	name string, args *CloudFormationStackArgs, opts ...pulumi.ResourceOption) (*CloudFormationStack, error) {
    98  	if args == nil {
    99  		return nil, errors.New("missing one or more required arguments")
   100  	}
   101  
   102  	if args.ApplicationId == nil {
   103  		return nil, errors.New("invalid value for required argument 'ApplicationId'")
   104  	}
   105  	if args.Capabilities == nil {
   106  		return nil, errors.New("invalid value for required argument 'Capabilities'")
   107  	}
   108  	opts = internal.PkgResourceDefaultOpts(opts)
   109  	var resource CloudFormationStack
   110  	err := ctx.RegisterResource("aws:serverlessrepository/cloudFormationStack:CloudFormationStack", name, args, &resource, opts...)
   111  	if err != nil {
   112  		return nil, err
   113  	}
   114  	return &resource, nil
   115  }
   116  
   117  // GetCloudFormationStack gets an existing CloudFormationStack resource's state with the given name, ID, and optional
   118  // state properties that are used to uniquely qualify the lookup (nil if not required).
   119  func GetCloudFormationStack(ctx *pulumi.Context,
   120  	name string, id pulumi.IDInput, state *CloudFormationStackState, opts ...pulumi.ResourceOption) (*CloudFormationStack, error) {
   121  	var resource CloudFormationStack
   122  	err := ctx.ReadResource("aws:serverlessrepository/cloudFormationStack:CloudFormationStack", name, id, state, &resource, opts...)
   123  	if err != nil {
   124  		return nil, err
   125  	}
   126  	return &resource, nil
   127  }
   128  
   129  // Input properties used for looking up and filtering CloudFormationStack resources.
   130  type cloudFormationStackState struct {
   131  	// The ARN of the application from the Serverless Application Repository.
   132  	ApplicationId *string `pulumi:"applicationId"`
   133  	// A list of capabilities. Valid values are `CAPABILITY_IAM`, `CAPABILITY_NAMED_IAM`, `CAPABILITY_RESOURCE_POLICY`, or `CAPABILITY_AUTO_EXPAND`
   134  	Capabilities []string `pulumi:"capabilities"`
   135  	// The name of the stack to create. The resource deployed in AWS will be prefixed with `serverlessrepo-`
   136  	Name *string `pulumi:"name"`
   137  	// A map of outputs from the stack.
   138  	Outputs map[string]string `pulumi:"outputs"`
   139  	// A map of Parameter structures that specify input parameters for the stack.
   140  	Parameters map[string]string `pulumi:"parameters"`
   141  	// The version of the application to deploy. If not supplied, deploys the latest version.
   142  	SemanticVersion *string `pulumi:"semanticVersion"`
   143  	// A list of tags to associate with this stack. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   144  	Tags map[string]string `pulumi:"tags"`
   145  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   146  	//
   147  	// Deprecated: Please use `tags` instead.
   148  	TagsAll map[string]string `pulumi:"tagsAll"`
   149  }
   150  
   151  type CloudFormationStackState struct {
   152  	// The ARN of the application from the Serverless Application Repository.
   153  	ApplicationId pulumi.StringPtrInput
   154  	// A list of capabilities. Valid values are `CAPABILITY_IAM`, `CAPABILITY_NAMED_IAM`, `CAPABILITY_RESOURCE_POLICY`, or `CAPABILITY_AUTO_EXPAND`
   155  	Capabilities pulumi.StringArrayInput
   156  	// The name of the stack to create. The resource deployed in AWS will be prefixed with `serverlessrepo-`
   157  	Name pulumi.StringPtrInput
   158  	// A map of outputs from the stack.
   159  	Outputs pulumi.StringMapInput
   160  	// A map of Parameter structures that specify input parameters for the stack.
   161  	Parameters pulumi.StringMapInput
   162  	// The version of the application to deploy. If not supplied, deploys the latest version.
   163  	SemanticVersion pulumi.StringPtrInput
   164  	// A list of tags to associate with this stack. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   165  	Tags pulumi.StringMapInput
   166  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   167  	//
   168  	// Deprecated: Please use `tags` instead.
   169  	TagsAll pulumi.StringMapInput
   170  }
   171  
   172  func (CloudFormationStackState) ElementType() reflect.Type {
   173  	return reflect.TypeOf((*cloudFormationStackState)(nil)).Elem()
   174  }
   175  
   176  type cloudFormationStackArgs struct {
   177  	// The ARN of the application from the Serverless Application Repository.
   178  	ApplicationId string `pulumi:"applicationId"`
   179  	// A list of capabilities. Valid values are `CAPABILITY_IAM`, `CAPABILITY_NAMED_IAM`, `CAPABILITY_RESOURCE_POLICY`, or `CAPABILITY_AUTO_EXPAND`
   180  	Capabilities []string `pulumi:"capabilities"`
   181  	// The name of the stack to create. The resource deployed in AWS will be prefixed with `serverlessrepo-`
   182  	Name *string `pulumi:"name"`
   183  	// A map of Parameter structures that specify input parameters for the stack.
   184  	Parameters map[string]string `pulumi:"parameters"`
   185  	// The version of the application to deploy. If not supplied, deploys the latest version.
   186  	SemanticVersion *string `pulumi:"semanticVersion"`
   187  	// A list of tags to associate with this stack. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   188  	Tags map[string]string `pulumi:"tags"`
   189  }
   190  
   191  // The set of arguments for constructing a CloudFormationStack resource.
   192  type CloudFormationStackArgs struct {
   193  	// The ARN of the application from the Serverless Application Repository.
   194  	ApplicationId pulumi.StringInput
   195  	// A list of capabilities. Valid values are `CAPABILITY_IAM`, `CAPABILITY_NAMED_IAM`, `CAPABILITY_RESOURCE_POLICY`, or `CAPABILITY_AUTO_EXPAND`
   196  	Capabilities pulumi.StringArrayInput
   197  	// The name of the stack to create. The resource deployed in AWS will be prefixed with `serverlessrepo-`
   198  	Name pulumi.StringPtrInput
   199  	// A map of Parameter structures that specify input parameters for the stack.
   200  	Parameters pulumi.StringMapInput
   201  	// The version of the application to deploy. If not supplied, deploys the latest version.
   202  	SemanticVersion pulumi.StringPtrInput
   203  	// A list of tags to associate with this stack. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   204  	Tags pulumi.StringMapInput
   205  }
   206  
   207  func (CloudFormationStackArgs) ElementType() reflect.Type {
   208  	return reflect.TypeOf((*cloudFormationStackArgs)(nil)).Elem()
   209  }
   210  
   211  type CloudFormationStackInput interface {
   212  	pulumi.Input
   213  
   214  	ToCloudFormationStackOutput() CloudFormationStackOutput
   215  	ToCloudFormationStackOutputWithContext(ctx context.Context) CloudFormationStackOutput
   216  }
   217  
   218  func (*CloudFormationStack) ElementType() reflect.Type {
   219  	return reflect.TypeOf((**CloudFormationStack)(nil)).Elem()
   220  }
   221  
   222  func (i *CloudFormationStack) ToCloudFormationStackOutput() CloudFormationStackOutput {
   223  	return i.ToCloudFormationStackOutputWithContext(context.Background())
   224  }
   225  
   226  func (i *CloudFormationStack) ToCloudFormationStackOutputWithContext(ctx context.Context) CloudFormationStackOutput {
   227  	return pulumi.ToOutputWithContext(ctx, i).(CloudFormationStackOutput)
   228  }
   229  
   230  // CloudFormationStackArrayInput is an input type that accepts CloudFormationStackArray and CloudFormationStackArrayOutput values.
   231  // You can construct a concrete instance of `CloudFormationStackArrayInput` via:
   232  //
   233  //	CloudFormationStackArray{ CloudFormationStackArgs{...} }
   234  type CloudFormationStackArrayInput interface {
   235  	pulumi.Input
   236  
   237  	ToCloudFormationStackArrayOutput() CloudFormationStackArrayOutput
   238  	ToCloudFormationStackArrayOutputWithContext(context.Context) CloudFormationStackArrayOutput
   239  }
   240  
   241  type CloudFormationStackArray []CloudFormationStackInput
   242  
   243  func (CloudFormationStackArray) ElementType() reflect.Type {
   244  	return reflect.TypeOf((*[]*CloudFormationStack)(nil)).Elem()
   245  }
   246  
   247  func (i CloudFormationStackArray) ToCloudFormationStackArrayOutput() CloudFormationStackArrayOutput {
   248  	return i.ToCloudFormationStackArrayOutputWithContext(context.Background())
   249  }
   250  
   251  func (i CloudFormationStackArray) ToCloudFormationStackArrayOutputWithContext(ctx context.Context) CloudFormationStackArrayOutput {
   252  	return pulumi.ToOutputWithContext(ctx, i).(CloudFormationStackArrayOutput)
   253  }
   254  
   255  // CloudFormationStackMapInput is an input type that accepts CloudFormationStackMap and CloudFormationStackMapOutput values.
   256  // You can construct a concrete instance of `CloudFormationStackMapInput` via:
   257  //
   258  //	CloudFormationStackMap{ "key": CloudFormationStackArgs{...} }
   259  type CloudFormationStackMapInput interface {
   260  	pulumi.Input
   261  
   262  	ToCloudFormationStackMapOutput() CloudFormationStackMapOutput
   263  	ToCloudFormationStackMapOutputWithContext(context.Context) CloudFormationStackMapOutput
   264  }
   265  
   266  type CloudFormationStackMap map[string]CloudFormationStackInput
   267  
   268  func (CloudFormationStackMap) ElementType() reflect.Type {
   269  	return reflect.TypeOf((*map[string]*CloudFormationStack)(nil)).Elem()
   270  }
   271  
   272  func (i CloudFormationStackMap) ToCloudFormationStackMapOutput() CloudFormationStackMapOutput {
   273  	return i.ToCloudFormationStackMapOutputWithContext(context.Background())
   274  }
   275  
   276  func (i CloudFormationStackMap) ToCloudFormationStackMapOutputWithContext(ctx context.Context) CloudFormationStackMapOutput {
   277  	return pulumi.ToOutputWithContext(ctx, i).(CloudFormationStackMapOutput)
   278  }
   279  
   280  type CloudFormationStackOutput struct{ *pulumi.OutputState }
   281  
   282  func (CloudFormationStackOutput) ElementType() reflect.Type {
   283  	return reflect.TypeOf((**CloudFormationStack)(nil)).Elem()
   284  }
   285  
   286  func (o CloudFormationStackOutput) ToCloudFormationStackOutput() CloudFormationStackOutput {
   287  	return o
   288  }
   289  
   290  func (o CloudFormationStackOutput) ToCloudFormationStackOutputWithContext(ctx context.Context) CloudFormationStackOutput {
   291  	return o
   292  }
   293  
   294  // The ARN of the application from the Serverless Application Repository.
   295  func (o CloudFormationStackOutput) ApplicationId() pulumi.StringOutput {
   296  	return o.ApplyT(func(v *CloudFormationStack) pulumi.StringOutput { return v.ApplicationId }).(pulumi.StringOutput)
   297  }
   298  
   299  // A list of capabilities. Valid values are `CAPABILITY_IAM`, `CAPABILITY_NAMED_IAM`, `CAPABILITY_RESOURCE_POLICY`, or `CAPABILITY_AUTO_EXPAND`
   300  func (o CloudFormationStackOutput) Capabilities() pulumi.StringArrayOutput {
   301  	return o.ApplyT(func(v *CloudFormationStack) pulumi.StringArrayOutput { return v.Capabilities }).(pulumi.StringArrayOutput)
   302  }
   303  
   304  // The name of the stack to create. The resource deployed in AWS will be prefixed with `serverlessrepo-`
   305  func (o CloudFormationStackOutput) Name() pulumi.StringOutput {
   306  	return o.ApplyT(func(v *CloudFormationStack) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   307  }
   308  
   309  // A map of outputs from the stack.
   310  func (o CloudFormationStackOutput) Outputs() pulumi.StringMapOutput {
   311  	return o.ApplyT(func(v *CloudFormationStack) pulumi.StringMapOutput { return v.Outputs }).(pulumi.StringMapOutput)
   312  }
   313  
   314  // A map of Parameter structures that specify input parameters for the stack.
   315  func (o CloudFormationStackOutput) Parameters() pulumi.StringMapOutput {
   316  	return o.ApplyT(func(v *CloudFormationStack) pulumi.StringMapOutput { return v.Parameters }).(pulumi.StringMapOutput)
   317  }
   318  
   319  // The version of the application to deploy. If not supplied, deploys the latest version.
   320  func (o CloudFormationStackOutput) SemanticVersion() pulumi.StringOutput {
   321  	return o.ApplyT(func(v *CloudFormationStack) pulumi.StringOutput { return v.SemanticVersion }).(pulumi.StringOutput)
   322  }
   323  
   324  // A list of tags to associate with this stack. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   325  func (o CloudFormationStackOutput) Tags() pulumi.StringMapOutput {
   326  	return o.ApplyT(func(v *CloudFormationStack) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   327  }
   328  
   329  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   330  //
   331  // Deprecated: Please use `tags` instead.
   332  func (o CloudFormationStackOutput) TagsAll() pulumi.StringMapOutput {
   333  	return o.ApplyT(func(v *CloudFormationStack) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   334  }
   335  
   336  type CloudFormationStackArrayOutput struct{ *pulumi.OutputState }
   337  
   338  func (CloudFormationStackArrayOutput) ElementType() reflect.Type {
   339  	return reflect.TypeOf((*[]*CloudFormationStack)(nil)).Elem()
   340  }
   341  
   342  func (o CloudFormationStackArrayOutput) ToCloudFormationStackArrayOutput() CloudFormationStackArrayOutput {
   343  	return o
   344  }
   345  
   346  func (o CloudFormationStackArrayOutput) ToCloudFormationStackArrayOutputWithContext(ctx context.Context) CloudFormationStackArrayOutput {
   347  	return o
   348  }
   349  
   350  func (o CloudFormationStackArrayOutput) Index(i pulumi.IntInput) CloudFormationStackOutput {
   351  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *CloudFormationStack {
   352  		return vs[0].([]*CloudFormationStack)[vs[1].(int)]
   353  	}).(CloudFormationStackOutput)
   354  }
   355  
   356  type CloudFormationStackMapOutput struct{ *pulumi.OutputState }
   357  
   358  func (CloudFormationStackMapOutput) ElementType() reflect.Type {
   359  	return reflect.TypeOf((*map[string]*CloudFormationStack)(nil)).Elem()
   360  }
   361  
   362  func (o CloudFormationStackMapOutput) ToCloudFormationStackMapOutput() CloudFormationStackMapOutput {
   363  	return o
   364  }
   365  
   366  func (o CloudFormationStackMapOutput) ToCloudFormationStackMapOutputWithContext(ctx context.Context) CloudFormationStackMapOutput {
   367  	return o
   368  }
   369  
   370  func (o CloudFormationStackMapOutput) MapIndex(k pulumi.StringInput) CloudFormationStackOutput {
   371  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *CloudFormationStack {
   372  		return vs[0].(map[string]*CloudFormationStack)[vs[1].(string)]
   373  	}).(CloudFormationStackOutput)
   374  }
   375  
   376  func init() {
   377  	pulumi.RegisterInputType(reflect.TypeOf((*CloudFormationStackInput)(nil)).Elem(), &CloudFormationStack{})
   378  	pulumi.RegisterInputType(reflect.TypeOf((*CloudFormationStackArrayInput)(nil)).Elem(), CloudFormationStackArray{})
   379  	pulumi.RegisterInputType(reflect.TypeOf((*CloudFormationStackMapInput)(nil)).Elem(), CloudFormationStackMap{})
   380  	pulumi.RegisterOutputType(CloudFormationStackOutput{})
   381  	pulumi.RegisterOutputType(CloudFormationStackArrayOutput{})
   382  	pulumi.RegisterOutputType(CloudFormationStackMapOutput{})
   383  }