Skip to content

Commit

Permalink
chore: update aws-cdk-lib to 2.141.0 from 2.132.1 (#3764)
Browse files Browse the repository at this point in the history
* chore: update aws-cdk-lib to 2.141.0 from 2.132.1

* chore: keep pnpm lock file at version 6

* Sync

---------

Co-authored-by: Frank <frank@sst.dev>
  • Loading branch information
berenddeboer and fwang committed May 17, 2024
1 parent b51f1fb commit 3c62d50
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 93 deletions.
5 changes: 5 additions & 0 deletions .changeset/swift-starfishes-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"sst": minor
---

chore: update aws-cdk-lib to 2.142.1 from 2.132.1.
2 changes: 1 addition & 1 deletion packages/create-sst/bin/presets/base/javascript/preset.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { extract, patch, install } from "create-sst";
export default [
extract(),
install({
packages: ["sst", "aws-cdk-lib@2.132.1", "constructs@10.3.0"],
packages: ["sst", "aws-cdk-lib@2.142.1", "constructs@10.3.0"],
dev: true,
}),
];
2 changes: 1 addition & 1 deletion packages/create-sst/bin/presets/dropin/astro/preset.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { patch, append, extract, install } from "create-sst";
export default [
extract(),
install({
packages: ["sst", "aws-cdk-lib@2.132.1", "constructs@10.3.0", "astro-sst"],
packages: ["sst", "aws-cdk-lib@2.142.1", "constructs@10.3.0", "astro-sst"],
dev: true,
}),
patch({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { patch, append, extract, install } from "create-sst";
export default [
extract(),
install({
packages: ["sst", "aws-cdk-lib@2.132.1", "constructs@10.3.0"],
packages: ["sst", "aws-cdk-lib@2.142.1", "constructs@10.3.0"],
dev: true,
}),
patch({
Expand Down
2 changes: 1 addition & 1 deletion packages/create-sst/bin/presets/dropin/nextjs/preset.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { patch, append, extract, install } from "create-sst";
export default [
extract(),
install({
packages: ["sst", "aws-cdk-lib@2.132.1", "constructs@10.3.0"],
packages: ["sst", "aws-cdk-lib@2.142.1", "constructs@10.3.0"],
dev: true,
}),
patch({
Expand Down
2 changes: 1 addition & 1 deletion packages/create-sst/bin/presets/dropin/remix/preset.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { patch, append, extract, install } from "create-sst";
export default [
extract(),
install({
packages: ["sst", "aws-cdk-lib@2.132.1", "constructs@10.3.0"],
packages: ["sst", "aws-cdk-lib@2.142.1", "constructs@10.3.0"],
dev: true,
}),
patch({
Expand Down
2 changes: 1 addition & 1 deletion packages/create-sst/bin/presets/dropin/solid/preset.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default [
install({
packages: [
"sst",
"aws-cdk-lib@2.132.1",
"aws-cdk-lib@2.142.1",
"constructs@10.3.0",
"solid-start-sst",
],
Expand Down
2 changes: 1 addition & 1 deletion packages/create-sst/bin/presets/dropin/svelte/preset.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default [
install({
packages: [
"sst",
"aws-cdk-lib@2.132.1",
"aws-cdk-lib@2.142.1",
"constructs@10.3.0",
"svelte-kit-sst",
],
Expand Down
14 changes: 7 additions & 7 deletions packages/sst/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
},
"homepage": "https://sst.dev",
"dependencies": {
"@aws-cdk/aws-lambda-python-alpha": "2.132.1-alpha.0",
"@aws-cdk/cloud-assembly-schema": "2.132.1",
"@aws-cdk/cloudformation-diff": "2.132.1",
"@aws-cdk/cx-api": "2.132.1",
"@aws-cdk/aws-lambda-python-alpha": "2.142.1-alpha.0",
"@aws-cdk/cloud-assembly-schema": "2.142.1",
"@aws-cdk/cloudformation-diff": "2.142.1",
"@aws-cdk/cx-api": "2.142.1",
"@aws-crypto/sha256-js": "^5.2.0",
"@aws-sdk/client-cloudformation": "^3.454.0",
"@aws-sdk/client-ecs": "^3.454.0",
Expand All @@ -63,11 +63,11 @@
"@smithy/signature-v4": "^2.0.16",
"@trpc/server": "9.16.0",
"adm-zip": "^0.5.10",
"aws-cdk-lib": "2.132.1",
"aws-cdk-lib": "2.142.1",
"aws-iot-device-sdk": "^2.2.13",
"aws-sdk": "^2.1501.0",
"builtin-modules": "3.2.0",
"cdk-assets": "2.132.1",
"cdk-assets": "2.142.1",
"chalk": "^5.2.0",
"chokidar": "^3.5.3",
"ci-info": "^3.7.0",
Expand Down Expand Up @@ -95,7 +95,7 @@
"ora": "^6.1.2",
"react": "^18.0.0",
"remeda": "^1.3.0",
"sst-aws-cdk": "2.132.1",
"sst-aws-cdk": "2.142.1",
"tree-kill": "^1.2.2",
"undici": "^5.12.0",
"uuid": "^9.0.0",
Expand Down
61 changes: 32 additions & 29 deletions packages/sst/src/cdk/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as cxapi from "@aws-cdk/cx-api";
import * as cdk_assets from "cdk-assets";
import { AssetManifest, IManifestEntry } from "cdk-assets";
import { Tag } from "sst-aws-cdk/lib/cdk-toolkit.js";
import { debug, warning } from "sst-aws-cdk/lib/logging.js";
import { debug, warning, error } from "sst-aws-cdk/lib/logging.js";
import {
buildAssets,
publishAssets,
Expand Down Expand Up @@ -33,8 +33,7 @@ import {
import {
loadCurrentTemplateWithNestedStacks,
loadCurrentTemplate,
flattenNestedStackNames,
TemplateWithNestedStackCount,
RootTemplateWithNestedStacks,
} from "sst-aws-cdk/lib/api/nested-stack-helpers.js";
import {
CloudFormationStack,
Expand Down Expand Up @@ -297,6 +296,7 @@ export interface DestroyStackOptions {
export interface StackExistsOptions {
stack: cxapi.CloudFormationStackArtifact;
deployName?: string;
tryLookupRole?: boolean;
}

export interface DeploymentsProps {
Expand Down Expand Up @@ -366,20 +366,14 @@ export class Deployments {
public async readCurrentTemplateWithNestedStacks(
rootStackArtifact: cxapi.CloudFormationStackArtifact,
retrieveProcessedTemplate: boolean = false
): Promise<Template> {
): Promise<RootTemplateWithNestedStacks> {
const sdk = (await this.prepareSdkWithLookupOrDeployRole(rootStackArtifact))
.stackSdk;
const templateWithNestedStacks = await loadCurrentTemplateWithNestedStacks(
return loadCurrentTemplateWithNestedStacks(
rootStackArtifact,
sdk,
retrieveProcessedTemplate
);
return {
deployedTemplate: templateWithNestedStacks.deployedTemplate,
nestedStackCount: flattenNestedStackNames(
templateWithNestedStacks.nestedStackNames
).length,
};
}

public async readCurrentTemplate(
Expand Down Expand Up @@ -513,11 +507,15 @@ export class Deployments {
}

public async stackExists(options: StackExistsOptions): Promise<boolean> {
const { stackSdk } = await this.prepareSdkFor(
options.stack,
undefined,
Mode.ForReading
);
let stackSdk;
if (options.tryLookupRole) {
stackSdk = (await this.prepareSdkWithLookupOrDeployRole(options.stack))
.stackSdk;
} else {
stackSdk = (
await this.prepareSdkFor(options.stack, undefined, Mode.ForReading)
).stackSdk;
}
const stack = await CloudFormationStack.lookup(
stackSdk.cloudFormation(),
options.deployName ?? options.stack.stackName
Expand Down Expand Up @@ -639,8 +637,8 @@ export class Deployments {

// try to assume the lookup role
const warningMessage = `Could not assume ${arns.lookupRoleArn}, proceeding anyway.`;
const upgradeMessage = `(To get rid of this warning, please upgrade to bootstrap version >= ${stack.lookupRole?.requiresBootstrapStackVersion})`;
try {
// Trying to assume lookup role and cache the sdk for the environment
const stackSdk = await this.cachedSdkForEnvironment(
resolvedEnvironment,
Mode.ForReading,
Expand All @@ -666,26 +664,31 @@ export class Deployments {
);
if (version < stack.lookupRole.requiresBootstrapStackVersion) {
throw new Error(
`Bootstrap stack version '${stack.lookupRole.requiresBootstrapStackVersion}' is required, found version '${version}'.`
`Bootstrap stack version '${stack.lookupRole.requiresBootstrapStackVersion}' is required, found version '${version}'. To get rid of this error, please upgrade to bootstrap version >= ${stack.lookupRole.requiresBootstrapStackVersion}`
);
}
// we may not have assumed the lookup role because one was not provided
// if that is the case then don't print the upgrade warning
} else if (
!stackSdk.didAssumeRole &&
stack.lookupRole?.requiresBootstrapStackVersion
) {
warning(upgradeMessage);
} else if (!stackSdk.didAssumeRole) {
const lookUpRoleExists = stack.lookupRole ? true : false;
warning(
`Lookup role ${
lookUpRoleExists ? "exists but" : "does not exist, hence"
} was not assumed. Proceeding with default credentials.`
);
}
return { ...stackSdk, resolvedEnvironment, envResources };
} catch (e: any) {
debug(e);
// only print out the warnings if the lookupRole exists AND there is a required
// bootstrap version, otherwise the warnings will print `undefined`
if (stack.lookupRole && stack.lookupRole.requiresBootstrapStackVersion) {

// only print out the warnings if the lookupRole exists
if (stack.lookupRole) {
warning(warningMessage);
warning(upgradeMessage);
}

// This error should be shown even if debug mode is off
if (e instanceof Error && e.message.includes("Bootstrap stack version")) {
error(e.message);
}

throw e;
}
}
Expand Down

0 comments on commit 3c62d50

Please sign in to comment.