gplassard / cdk-cloudformation-extensions

Repository from Github https://github.comgplassard/cdk-cloudformation-extensionsRepository from Github https://github.comgplassard/cdk-cloudformation-extensions

cdk-cloudformation-extensions

Based on aws/aws-cdk-rfcs#72 (comment)

Documentation : https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/protect-stack-resources.html

Installation

echo "@gplassard:registry=https://npm.pkg.github.com" > .npmrc
yarn add -D @gplassard/cdk-cloudformation-extensions

Usage

// bin/app.ts
import { ApplicationStack } from './lib/ApplicationStack';
import { StackPolicy, StackPoliciesStack } from '@gplassard/cdk-cloudformation-extensions';

const app = new cdk.App();
// create an application stack
const stack = new MyApplicationStack(app, 'ApplicationStack', {
});
// create another stack which will attach stack policies to our applications stacks
new StackPoliciesStack(app, 'StackPolicies', {
    stackPoliciesAssignment: [
        {
            stack: stack,
            policy: {
                Statement: [
                    {
                        Effect: 'Allow',
                        Action: 'Update:*',
                        Principal: '*',
                        Resource: '*',
                    },
                ],
            }
        }
    ]
});
app.synth();

About

License:Apache License 2.0


Languages

Language:TypeScript 100.0%