Skip to content

Commit

Permalink
Merge branch 'master' into add-cron-method-to-canary-schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Nov 1, 2021
2 parents 3ccce4f + 135f7d3 commit 6334a52
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 8 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ on:

jobs:
auto-approve:
if: >
github.event.pull_request.user.login == 'dependabot[bot]'
|| github.event.pull_request.user.login == 'dependabot-preview[bot]'
|| (contains(github.event.pull_request.labels.*.name, 'pr/auto-approve')
&& github.event.pull_request.user.login == 'aws-cdk-automation')
if: contains(github.event.pull_request.labels.*.name, 'pr/auto-approve')
runs-on: ubuntu-latest
permissions:
pull-requests: write
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Apply various labels on PRs

name: pr-labeler
on:
pull_request:
types: [ opened ]

jobs:
auto-approve:
if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'dependabot-preview[bot]'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- run: gh pr edit ${{ github.event.pull_request.number }} --add-label "pr/auto-approve" -R ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-docdb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ your instances will be launched privately or publicly:
const cluster = new DatabaseCluster(this, 'Database', {
masterUser: {
username: 'myuser' // NOTE: 'admin' is reserved by DocumentDB
excludeCharacters: '\"@/:', // optional, defaults to the set "\"@/"
},
instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.LARGE),
vpcSubnets: {
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-docdb/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ export class DatabaseCluster extends DatabaseClusterBase {
secret = new DatabaseSecret(this, 'Secret', {
username: props.masterUser.username,
encryptionKey: props.masterUser.kmsKey,
excludeCharacters: props.masterUser.excludeCharacters,
});
}

Expand Down
9 changes: 8 additions & 1 deletion packages/@aws-cdk/aws-docdb/lib/database-secret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ export interface DatabaseSecretProps {
* @default - no master secret information will be included
*/
readonly masterSecret?: ISecret;

/**
* Characters to not include in the generated password.
*
* @default "\"@/"
*/
readonly excludeCharacters?: string;
}

/**
Expand Down Expand Up @@ -61,7 +68,7 @@ export class DatabaseSecret extends Secret {
masterarn: props.masterSecret?.secretArn,
}),
generateStringKey: 'password',
excludeCharacters: '"@/',
excludeCharacters: props.excludeCharacters ?? '"@/',
},
});
}
Expand Down
7 changes: 7 additions & 0 deletions packages/@aws-cdk/aws-docdb/lib/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ export interface Login {
* @default default master key
*/
readonly kmsKey?: kms.IKey;

/**
* Specifies characters to not include in generated passwords.
*
* @default "\"@/"
*/
readonly excludeCharacters?: string;
}

/**
Expand Down
25 changes: 24 additions & 1 deletion packages/@aws-cdk/aws-docdb/test/cluster.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect as expectCDK, haveResource, ResourcePart, arrayWith } from '@aws-cdk/assert-internal';
import { expect as expectCDK, haveResource, ResourcePart, arrayWith, haveResourceLike, objectLike } from '@aws-cdk/assert-internal';
import * as ec2 from '@aws-cdk/aws-ec2';
import * as kms from '@aws-cdk/aws-kms';
import * as cdk from '@aws-cdk/core';
Expand Down Expand Up @@ -293,6 +293,29 @@ describe('DatabaseCluster', () => {
}));
});

test('creates a secret with excludeCharacters', () => {
// GIVEN
const stack = testStack();
const vpc = new ec2.Vpc(stack, 'VPC');

// WHEN
new DatabaseCluster(stack, 'Database', {
masterUser: {
username: 'admin',
excludeCharacters: '"@/()[]',
},
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL),
vpc,
});

// THEN
expectCDK(stack).to(haveResourceLike('AWS::SecretsManager::Secret', {
GenerateSecretString: objectLike({
ExcludeCharacters: '\"@/()[]',
}),
}));
});

test('create an encrypted cluster with custom KMS key', () => {
// GIVEN
const stack = testStack();
Expand Down
10 changes: 10 additions & 0 deletions packages/@aws-cdk/aws-ec2/lib/instance-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,16 @@ export enum InstanceClass {
*/
C5 = 'c5',

/**
* Compute optimized instances, 6th generation
*/
COMPUTE6_INTEL = 'c6i',

/**
* Compute optimized instances, 6th generation
*/
C6I = 'c6i',

/**
* Compute optimized instances with local NVME drive, 5th generation
*/
Expand Down
2 changes: 1 addition & 1 deletion tools/@aws-cdk/cdk-build-tools/lib/package-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function packageCompiler(compilers: CompilerOverrides, options?: CDKBuild
if (isJsii()) {
const args = ['--silence-warnings=reserved-word'];
if (options?.stripDeprecated) {
args.push('--strip-deprecated');
args.push(`--strip-deprecated ${path.join(__dirname, '..', '..', '..', '..', 'deprecated_apis.txt')}`);
}
return [compilers.jsii || require.resolve('jsii/bin/jsii'), ...args];
} else {
Expand Down

0 comments on commit 6334a52

Please sign in to comment.