Skip to content

Commit fce0e9c

Browse files
authored
Merge branch 'main' into SankyRed/dlc-accounts
2 parents 64a68d1 + 65f2bd9 commit fce0e9c

117 files changed

Lines changed: 17552 additions & 154 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/github-merit-badger.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ jobs:
1717
badges: '[beginning-contributor,repeat-contributor,valued-contributor,admired-contributor,star-contributor,distinguished-contributor]'
1818
thresholds: '[0,3,6,13,25,50]'
1919
badge-type: 'achievement'
20-
ignore-usernames: '[rix0rrr,iliapolo,otaviomacedo,kaizencc,comcalvi,TheRealAmazonKendra,vinayak-kukreja,mrgrain,pahud,cgarvis,kellertk,HBobertz,sumupitchayan,SankyRed,udaypant,colifran,khushail,scanlonp,mikewrighton,moelasmar,paulhcsun,awsmjs,evgenyka,GavinZZ,aaythapa,xazhao,ConnorRobertson,ssenchenko,gracelu0,jfuss,SimonCMoore,shikha372,kirtishrinkhala,godwingrs22,bergjaak,aws-cdk-automation,dependabot[bot],mergify[bot]]'
20+
ignore-usernames: '[rix0rrr,iliapolo,otaviomacedo,kaizencc,comcalvi,TheRealAmazonKendra,vinayak-kukreja,mrgrain,pahud,cgarvis,kellertk,HBobertz,sumupitchayan,SankyRed,udaypant,colifran,khushail,scanlonp,mikewrighton,moelasmar,paulhcsun,awsmjs,evgenyka,GavinZZ,aaythapa,xazhao,ConnorRobertson,ssenchenko,gracelu0,jfuss,SimonCMoore,shikha372,kirtishrinkhala,godwingrs22,bergjaak,Leo10Gama,aws-cdk-automation,dependabot[bot],mergify[bot]]'

.github/workflows/request-cli-integ-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
persist-credentials: false
2020
- name: Find changed cli files
2121
id: changed-cli-files
22-
uses: tj-actions/changed-files@0874344d6ebbaa00a27da73276ae7162fadcaf69
22+
uses: tj-actions/changed-files@a29e8b565651ce417abb5db7164b4a2ad8b6155c
2323
with:
2424
base_sha: ${{ github.event.pull_request.base.sha }}
2525
files_yaml: |

.mergify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pull_request_rules:
1111
label:
1212
add: [ contribution/core ]
1313
conditions:
14-
- author~=^(rix0rrr|iliapolo|otaviomacedo|kaizencc|comcalvi|TheRealAmazonKendra|vinayak-kukreja|mrgrain|pahud|cgarvis|kellertk|HBobertz|sumupitchayan|SankyRed|udaypant|colifran|scanlonp|mikewrighton|moelasmar|paulhcsun|awsmjs|evgenyka|GavinZZ|aaythapa|xazhao|ConnorRobertson|ssenchenko|gracelu0|jfuss|SimonCMoore|shikha372|kirtishrinkhala|godwingrs22|bergjaak)$
14+
- author~=^(rix0rrr|iliapolo|otaviomacedo|kaizencc|comcalvi|TheRealAmazonKendra|vinayak-kukreja|mrgrain|pahud|cgarvis|kellertk|HBobertz|sumupitchayan|SankyRed|udaypant|colifran|scanlonp|mikewrighton|moelasmar|paulhcsun|awsmjs|evgenyka|GavinZZ|aaythapa|xazhao|ConnorRobertson|ssenchenko|gracelu0|jfuss|SimonCMoore|shikha372|kirtishrinkhala|godwingrs22|bergjaak|Leo10Gama)$
1515
- -label~="contribution/core"
1616
- name: automatic merge
1717
actions:

packages/@aws-cdk-testing/cli-integ/resources/cdk-apps/app/app.js

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,37 @@ class MigrateStack extends cdk.Stack {
248248
}
249249
}
250250

251-
class ImportableStack extends MigrateStack {
251+
class ImportableStack extends cdk.Stack {
252252
constructor(parent, id, props) {
253253
super(parent, id, props);
254254
new cdk.CfnWaitConditionHandle(this, 'Handle');
255+
256+
if (process.env.INCLUDE_SINGLE_QUEUE === '1') {
257+
const queue = new sqs.Queue(this, 'Queue', {
258+
removalPolicy: (process.env.RETAIN_SINGLE_QUEUE === '1') ? cdk.RemovalPolicy.RETAIN : cdk.RemovalPolicy.DESTROY,
259+
});
260+
261+
new cdk.CfnOutput(this, 'QueueName', {
262+
value: queue.queueName,
263+
});
264+
265+
new cdk.CfnOutput(this, 'QueueUrl', {
266+
value: queue.queueUrl,
267+
});
268+
269+
new cdk.CfnOutput(this, 'QueueLogicalId', {
270+
value: queue.node.defaultChild.logicalId,
271+
});
272+
}
273+
274+
if (process.env.LARGE_TEMPLATE === '1') {
275+
for (let i = 1; i <= 70; i++) {
276+
new sqs.Queue(this, `cdk-import-queue-test${i}`, {
277+
enforceSSL: true,
278+
removalPolicy: cdk.RemovalPolicy.DESTROY,
279+
});
280+
}
281+
}
255282
}
256283
}
257284

packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/cli.integtest.ts

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,37 +1619,60 @@ integTest('skips notice refresh', withDefaultFixture(async (fixture) => {
16191619
}));
16201620

16211621
/**
1622-
* Create a queue with a fresh name, redeploy orphaning the queue, then import it again
1622+
* Create a queue, orphan that queue, then import the queue.
1623+
*
1624+
* We want to test with a large template to make sure large templates can work with import.
16231625
*/
16241626
integTest('test resource import', withDefaultFixture(async (fixture) => {
1625-
const outputsFile = path.join(fixture.integTestDir, 'outputs', 'outputs.json');
1627+
// GIVEN
1628+
const randomPrefix = randomString();
1629+
const uniqueOutputsFileName = `${randomPrefix}Outputs.json`; // other tests use the outputs file. Make sure we don't collide.
1630+
const outputsFile = path.join(fixture.integTestDir, 'outputs', uniqueOutputsFileName);
16261631
await fs.mkdir(path.dirname(outputsFile), { recursive: true });
16271632

1628-
// Initial deploy
1633+
// First, create a stack that includes many queues, and one queue that will be removed from the stack but NOT deleted from AWS.
16291634
await fixture.cdkDeploy('importable-stack', {
1630-
modEnv: { ORPHAN_TOPIC: '1' },
1635+
modEnv: { LARGE_TEMPLATE: '1', INCLUDE_SINGLE_QUEUE: '1', RETAIN_SINGLE_QUEUE: '1' },
16311636
options: ['--outputs-file', outputsFile],
16321637
});
16331638

1634-
const outputs = JSON.parse((await fs.readFile(outputsFile, { encoding: 'utf-8' })).toString());
1635-
const queueName = outputs.QueueName;
1636-
const queueLogicalId = outputs.QueueLogicalId;
1637-
fixture.log(`Setup complete, created queue ${queueName}`);
16381639
try {
1639-
// Deploy again, orphaning the queue
1640+
1641+
// Second, now the queue we will remove is in the stack and has a logicalId. We can now make the resource mapping file.
1642+
// This resource mapping file will be used to tell the import operation what queue to bring into the stack.
1643+
const fullStackName = fixture.fullStackName('importable-stack');
1644+
const outputs = JSON.parse((await fs.readFile(outputsFile, { encoding: 'utf-8' })).toString());
1645+
const queueLogicalId = outputs[fullStackName].QueueLogicalId;
1646+
const queueResourceMap = {
1647+
[queueLogicalId]: { QueueUrl: outputs[fullStackName].QueueUrl },
1648+
};
1649+
const mappingFile = path.join(fixture.integTestDir, 'outputs', `${randomPrefix}Mapping.json`);
1650+
await fs.writeFile(
1651+
mappingFile,
1652+
JSON.stringify(queueResourceMap),
1653+
{ encoding: 'utf-8' },
1654+
);
1655+
1656+
// Third, remove the queue from the stack, but don't delete the queue from AWS.
16401657
await fixture.cdkDeploy('importable-stack', {
1641-
modEnv: { OMIT_TOPIC: '1' },
1658+
modEnv: { LARGE_TEMPLATE: '1', INCLUDE_SINGLE_QUEUE: '0', RETAIN_SINGLE_QUEUE: '0' },
16421659
});
1660+
const cfnTemplateBeforeImport = await fixture.aws.cloudFormation('getTemplate', { StackName: fullStackName });
1661+
expect(cfnTemplateBeforeImport.TemplateBody).not.toContain(queueLogicalId);
16431662

1644-
// Write a resource mapping file based on the ID from step one, then run an import
1645-
const mappingFile = path.join(fixture.integTestDir, 'outputs', 'mapping.json');
1646-
await fs.writeFile(mappingFile, JSON.stringify({ [queueLogicalId]: { QueueName: queueName } }), { encoding: 'utf-8' });
1663+
// WHEN
1664+
await fixture.cdk(
1665+
['import', '--resource-mapping', mappingFile, fixture.fullStackName('importable-stack')],
1666+
{ modEnv: { LARGE_TEMPLATE: '1', INCLUDE_SINGLE_QUEUE: '1', RETAIN_SINGLE_QUEUE: '0' } },
1667+
);
16471668

1648-
await fixture.cdk(['import',
1649-
'--resource-mapping', mappingFile,
1650-
fixture.fullStackName('importable-stack')]);
1669+
// THEN
1670+
const describeStacksResponse = await fixture.aws.cloudFormation('describeStacks', { StackName: fullStackName });
1671+
const cfnTemplateAfterImport = await fixture.aws.cloudFormation('getTemplate', { StackName: fullStackName });
1672+
expect(describeStacksResponse.Stacks![0].StackStatus).toEqual('IMPORT_COMPLETE');
1673+
expect(cfnTemplateAfterImport.TemplateBody).toContain(queueLogicalId);
16511674
} finally {
1652-
// Cleanup
1675+
// Clean up
16531676
await fixture.cdkDestroy('importable-stack');
16541677
}
16551678
}));
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import json
2+
3+
def handler(event, context):
4+
print("Event: ", event)
5+
return {
6+
'statusCode': 200,
7+
'body': json.dumps({'message': 'Hello from Lambda l2!'})
8+
}

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.api-with-authorizer-and-proxy.js.snapshot/apigatewaywithauthorizerandproxyDefaultTestDeployAssertDBEA1774.assets.json

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.api-with-authorizer-and-proxy.js.snapshot/apigatewaywithauthorizerandproxyDefaultTestDeployAssertDBEA1774.template.json

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.api-with-authorizer-and-proxy.js.snapshot/asset.8b7a863f778f5314bab7fdad7a7957ef133c826bb93a8611a3bac36ae684e683/index.py

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.api-with-authorizer-and-proxy.js.snapshot/cdk.out

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)