Skip to content

Commit

Permalink
feat: allow multi region stackset deployments with assets
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh DeMuth committed Jan 18, 2024
1 parent afd12b6 commit 9f588a1
Show file tree
Hide file tree
Showing 15 changed files with 531 additions and 386 deletions.
12 changes: 9 additions & 3 deletions .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .projenrc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CdklabsConstructLibrary } from 'cdklabs-projen-project-types';
import { JsonPatch } from 'projen';

const MIN_CDK_VERSION = '2.108.0';
const MIN_CDK_VERSION = '2.113.0';
const project = new CdklabsConstructLibrary({
projenrcTs: true,
author: 'AWS',
Expand All @@ -10,7 +10,7 @@ const project = new CdklabsConstructLibrary({
defaultReleaseBranch: 'main',
name: 'cdk-stacksets',
repositoryUrl: 'https://github.com/cdklabs/cdk-stacksets.git',
devDeps: ['cdklabs-projen-project-types', '@aws-cdk/integ-tests-alpha', `@aws-cdk/integ-runner@${MIN_CDK_VERSION}`, `aws-cdk@${MIN_CDK_VERSION}`],
devDeps: ['cdklabs-projen-project-types', `@aws-cdk/cloud-assembly-schema@${MIN_CDK_VERSION}`, `@aws-cdk/integ-tests-alpha@${MIN_CDK_VERSION}-alpha.0`, `@aws-cdk/integ-runner@${MIN_CDK_VERSION}`, `aws-cdk@${MIN_CDK_VERSION}`],
publishDryRun: false,
private: false,
});
Expand Down
51 changes: 37 additions & 14 deletions API.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@ AWS accounts when they are added or removed from the specified organizational un

You can use the StackSet's parent stack to facilitate file assets. Behind the scenes,
this is accomplished using the `BucketDeployment` construct from the
`aws_s3_deployment` module. You need to provide a bucket outside the scope of the CDK
managed asset buckets and ensure you have persmissions for the target accounts to pull
the artifacts from the supplied bucket.
`aws_s3_deployment` module. You need to provide a list of buckets outside the scope of the CDK
managed asset buckets and ensure you have permissions for the target accounts to pull
the artifacts from the supplied bucket(s).

As a basic example, if using a `serviceManaged` deployment, you just need to give read
access to the Organization. You can create the asset bucket in the parent stack, or another
Expand All @@ -267,7 +267,7 @@ If creating in the parent or sibling stack you could create and export similar t

```ts
const bucket = new s3.Bucket(this, "Assets", {
bucketName: "cdkstacket-asset-bucket-xyz",
bucketName: "prefix-us-east-1",
});

bucket.addToResourcePolicy(
Expand All @@ -285,11 +285,16 @@ Then pass as a prop to the StackSet stack:
declare const bucket: s3.Bucket;
const stack = new Stack();
const stackSetStack = new StackSetStack(stack, 'MyStackSet', {
assetBucket: bucket,
assetBuckets: [bucket],
});
```

Then call `new StackSet` as described in the sections above.
To faciliate multi region deployments, there is an assetPrefix property. This
gets added to the region the Stack Set is deployed to. The stack synthesis for
the Stack Set would look for a bucket named `prefix-{Region}` in the example
above. `{Region}` is whatever region you are deploying the Stack Set to as
defined in your target property of the StackSet. You will need to ensure the
bucket name is correct based on what was previously created and then passed in.

You can use self-managed StackSet deployments with file assets too but will
need to ensure all target accounts roles will have access to the central asset
Expand Down
7 changes: 4 additions & 3 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9f588a1

Please sign in to comment.