CloudFormationStack class

Manages an Application CloudFormation Stack from the Serverless Application Repository.

> Warning: CloudFormation masks NoEcho parameter values as **** in API responses, which may set an expectation that they remain hidden. They do not — like any other argument, the configured value is persisted to state. To mask a specific parameter in plan and terraform show output, wrap it with Terraform's sensitive() function, for example parameters = { password = sensitive(var.password) }.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const current = aws.getPartition({});
const currentGetRegion = aws.getRegion({});
const postgres_rotator = new aws.serverlessrepository.CloudFormationStack("postgres-rotator", {
    name: "postgres-rotator",
    applicationId: "arn:aws:serverlessrepo:us-east-1:297356227824:applications/SecretsManagerRDSPostgreSQLRotationSingleUser",
    capabilities: [
        "CAPABILITY_IAM",
        "CAPABILITY_RESOURCE_POLICY",
    ],
    parameters: {
        functionName: "func-postgres-rotator",
        endpoint: Promise.all([currentGetRegion, current]).then(([currentGetRegion, current]) => `secretsmanager.${currentGetRegion.region}.${current.dnsSuffix}`),
    },
});
import pulumi
import pulumi_aws as aws

current = aws.get_partition()
current_get_region = aws.get_region()
postgres_rotator = aws.serverlessrepository.CloudFormationStack("postgres-rotator",
    name="postgres-rotator",
    application_id="arn:aws:serverlessrepo:us-east-1:297356227824:applications/SecretsManagerRDSPostgreSQLRotationSingleUser",
    capabilities=[
        "CAPABILITY_IAM",
        "CAPABILITY_RESOURCE_POLICY",
    ],
    parameters={
        "functionName": "func-postgres-rotator",
        "endpoint": f"secretsmanager.{current_get_region.region}.{current.dns_suffix}",
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var current = Aws.GetPartition.Invoke();

    var currentGetRegion = Aws.GetRegion.Invoke();

    var postgres_rotator = new Aws.ServerlessRepository.CloudFormationStack("postgres-rotator", new()
    {
        Name = "postgres-rotator",
        ApplicationId = "arn:aws:serverlessrepo:us-east-1:297356227824:applications/SecretsManagerRDSPostgreSQLRotationSingleUser",
        Capabilities = new[]
        {
            "CAPABILITY_IAM",
            "CAPABILITY_RESOURCE_POLICY",
        },
        Parameters =
        {
            { "functionName", "func-postgres-rotator" },
            { "endpoint", Output.Tuple(currentGetRegion, current).Apply(values =>
            {
                var currentGetRegion = values.Item1;
                var current = values.Item2;
                return $"secretsmanager.{currentGetRegion.Apply(getRegionResult => getRegionResult.Region)}.{current.Apply(getPartitionResult => getPartitionResult.DnsSuffix)}";
            }) },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/serverlessrepository"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		current, err := aws.GetPartition(ctx, &aws.GetPartitionArgs{}, nil)
		if err != nil {
			return err
		}
		currentGetRegion, err := aws.GetRegion(ctx, &aws.GetRegionArgs{}, nil)
		if err != nil {
			return err
		}
		_, err = serverlessrepository.NewCloudFormationStack(ctx, "postgres-rotator", &serverlessrepository.CloudFormationStackArgs{
			Name:          pulumi.String("postgres-rotator"),
			ApplicationId: pulumi.String("arn:aws:serverlessrepo:us-east-1:297356227824:applications/SecretsManagerRDSPostgreSQLRotationSingleUser"),
			Capabilities: pulumi.StringArray{
				pulumi.String("CAPABILITY_IAM"),
				pulumi.String("CAPABILITY_RESOURCE_POLICY"),
			},
			Parameters: pulumi.StringMap{
				"functionName": pulumi.String("func-postgres-rotator"),
				"endpoint":     pulumi.Sprintf("secretsmanager.%v.%v", currentGetRegion.Region, current.DnsSuffix),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

data "aws_getpartition" "current" {
}
data "aws_getregion" "currentGetRegion" {
}

resource "aws_serverlessrepository_cloudformationstack" "postgres-rotator" {
  name           = "postgres-rotator"
  application_id = "arn:aws:serverlessrepo:us-east-1:297356227824:applications/SecretsManagerRDSPostgreSQLRotationSingleUser"
  capabilities   = ["CAPABILITY_IAM", "CAPABILITY_RESOURCE_POLICY"]
  parameters = {
    "functionName" = "func-postgres-rotator"
    "endpoint"     ="secretsmanager.${data.aws_getregion.currentGetRegion.region}.${data.aws_getpartition.current.dns_suffix}"
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetPartitionArgs;
import com.pulumi.aws.inputs.GetRegionArgs;
import com.pulumi.aws.serverlessrepository.CloudFormationStack;
import com.pulumi.aws.serverlessrepository.CloudFormationStackArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 current = AwsFunctions.getPartition(GetPartitionArgs.builder()
            .build());

        final var currentGetRegion = AwsFunctions.getRegion(GetRegionArgs.builder()
            .build());

        var postgres_rotator = new CloudFormationStack("postgres-rotator", CloudFormationStackArgs.builder()
            .name("postgres-rotator")
            .applicationId("arn:aws:serverlessrepo:us-east-1:297356227824:applications/SecretsManagerRDSPostgreSQLRotationSingleUser")
            .capabilities(
                "CAPABILITY_IAM",
                "CAPABILITY_RESOURCE_POLICY")
            .parameters(Map.ofEntries(
                Map.entry("functionName", "func-postgres-rotator"),
                Map.entry("endpoint", String.format("secretsmanager.%s.%s", currentGetRegion.region(),current.dnsSuffix()))
            ))
            .build());

    }
}
resources:
  postgres-rotator:
    type: aws:serverlessrepository:CloudFormationStack
    properties:
      name: postgres-rotator
      applicationId: arn:aws:serverlessrepo:us-east-1:297356227824:applications/SecretsManagerRDSPostgreSQLRotationSingleUser
      capabilities:
        - CAPABILITY_IAM
        - CAPABILITY_RESOURCE_POLICY
      parameters:
        functionName: func-postgres-rotator
        endpoint: secretsmanager.${currentGetRegion.region}.${current.dnsSuffix}
variables:
  current:
    fn::invoke:
      function: aws:getPartition
      arguments: {}
  currentGetRegion:
    fn::invoke:
      function: aws:getRegion
      arguments: {}

Import

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:

$ pulumi import aws:serverlessrepository/cloudFormationStack:CloudFormationStack example serverlessrepo-postgres-rotator

Constructors

CloudFormationStack(String name, {CloudFormationStackArgs? args, CustomResourceOptions? options})
Creates a new CloudFormationStack. name The Pulumi resource name. args Arguments used to configure this CloudFormationStack. The set of arguments for CloudFormationStack. options Resource options controlling this resource's behavior.
CloudFormationStack.reference(String urn)
Creates a typed reference to an existing CloudFormationStack resource.

Properties

applicationId ↔ Output<String>
ARN of the application from the Serverless Application Repository.
latefinal
capabilities ↔ Output<List<String>>
List of capabilities. Valid values are CAPABILITY_IAM, CAPABILITY_NAMED_IAM, CAPABILITY_RESOURCE_POLICY, or CAPABILITY_AUTO_EXPAND. If the application contains IAM resources, IAM resources with custom names, resource-based policies, or nested applications, the corresponding capability must be specified. If omitted, the value applied by AWS is tracked in state.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
name ↔ Output<String>
Name of the stack to create. The resource deployed in AWS will be prefixed with serverlessrepo-
latefinal
outputs ↔ Output<Map<String, String>>
Map of outputs from the stack.
latefinal
parameters ↔ Output<Map<String, String>>
Map of Parameter structures that specify input parameters for the stack.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticVersion ↔ Output<String>
Version of the application to deploy. If not supplied, deploys the latest version.
latefinal
tags ↔ Output<Map<String, String>?>
Map of tags assigned to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {CloudFormationStackState? state, CustomResourceOptions? options}) → CloudFormationStack
Gets an existing CloudFormationStack resource's state with the given name and id.