Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): template created during import should be written to assets folder #29830

Merged
merged 28 commits into from May 10, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c332aff
fix: import should write overrideTemplate to assembly.outdir
nburtsev Mar 15, 2024
8d73b83
Merge branch 'main' into main
nburtsev Mar 15, 2024
b91e06a
Merge branch 'main' into fix/cdk-import-template-path
nburtsev Mar 18, 2024
8b5e5cb
fix: update cli import test to ensure template tiss larger than 50kb
nburtsev Mar 23, 2024
16f3529
Merge branch 'main' into fix/cdk-import-template-path
nburtsev Mar 23, 2024
b798c93
Merge branch 'main' into fix/cdk-import-template-path
nburtsev Mar 26, 2024
3f3f730
Merge branch 'main' into fix/cdk-import-template-path
nburtsev Apr 6, 2024
de6d0da
Merge branch 'main' into fix/cdk-import-template-path
nburtsev Apr 15, 2024
de09c72
Merge branch 'main' into fix/cdk-import-template-path
nburtsev Apr 15, 2024
72af4a2
Merge branch 'main' into fix/cdk-import-template-path
nburtsev Apr 16, 2024
8578e9f
Merge branch 'main' of github.com:aws/aws-cdk into fix/cdk-import-tem…
bergjaak May 8, 2024
84a9409
Merge branch 'main' into fix/cdk-import-template-path
bergjaak May 8, 2024
75a5dcb
in progress
bergjaak May 8, 2024
c520676
made test actually work
bergjaak May 9, 2024
ca4607e
Merge branch 'main' of github.com:aws/aws-cdk into fix/cdk-import-tem…
bergjaak May 9, 2024
69cbad7
Merge branch 'main' of github.com:aws/aws-cdk into fix/cdk-import-tem…
bergjaak May 9, 2024
06a62be
Merge branch 'main' of github.com:aws/aws-cdk into fix/cdk-import-tem…
bergjaak May 9, 2024
a6f2c82
made test pass
bergjaak May 9, 2024
d6f4308
test
colifran May 9, 2024
7157944
remove test comment
colifran May 9, 2024
02fd882
Merge branch 'fix/cdk-import-template-path' of https://github.com/nbu…
bergjaak May 9, 2024
0261c0a
Merge branch 'main' of github.com:aws/aws-cdk into fix/cdk-import-tem…
bergjaak May 10, 2024
bd0eb88
fix failing tests
bergjaak May 10, 2024
fa109b3
use cfn fixture
bergjaak May 10, 2024
75918ac
fix test again
bergjaak May 10, 2024
7e3b24e
remove duplicate line
bergjaak May 10, 2024
2cb9614
improve test comments
bergjaak May 10, 2024
f5cc882
Merge branch 'main' into fix/cdk-import-template-path
mergify[bot] May 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -142,6 +142,15 @@ class MigrateStack extends cdk.Stack {
value: queue.node.defaultChild.logicalId,
});
}

if (process.env.LARGE_TEMPLATE) {
for (let i = 0; i < 70; i++) {
const q = new sqs.Queue(this, `cdk-import-queue-test${i}`, {
enforceSSL: true,
});
}
}

if (process.env.SAMPLE_RESOURCES) {
const myTopic = new sns.Topic(this, 'migratetopic1', {
removalPolicy: cdk.RemovalPolicy.DESTROY,
Expand Down
Expand Up @@ -1431,7 +1431,7 @@ integTest('test resource import', withDefaultFixture(async (fixture) => {

// Initial deploy
await fixture.cdkDeploy('importable-stack', {
modEnv: { ORPHAN_TOPIC: '1' },
modEnv: { ORPHAN_TOPIC: '1', LARGE_TEMPLATE: '1' },
options: ['--outputs-file', outputsFile],
});

Expand All @@ -1442,7 +1442,7 @@ integTest('test resource import', withDefaultFixture(async (fixture) => {
try {
// Deploy again, orphaning the queue
await fixture.cdkDeploy('importable-stack', {
modEnv: { OMIT_TOPIC: '1' },
modEnv: { OMIT_TOPIC: '1', LARGE_TEMPLATE: '1' },
});

// Write a resource mapping file based on the ID from step one, then run an import
Expand Down
4 changes: 3 additions & 1 deletion packages/aws-cdk/lib/api/util/template-body-parameter.ts
@@ -1,3 +1,4 @@
import * as path from 'path';
import * as cxapi from '@aws-cdk/cx-api';
import * as chalk from 'chalk';
import * as fs from 'fs-extra';
Expand Down Expand Up @@ -68,7 +69,8 @@ export async function makeBodyParameter(
if (overrideTemplate) {
// Add a variant of this template
templateFile = `${stack.templateFile}-${templateHash}.yaml`;
await fs.writeFile(templateFile, templateJson, { encoding: 'utf-8' });
const templateFilePath = path.join(stack.assembly.directory, templateFile);
await fs.writeFile(templateFilePath, templateJson, { encoding: 'utf-8' });
}

assetManifest.addFileAsset(templateHash, {
Expand Down