sst 2.49.3 → 2.49.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/package.json.bak
CHANGED
package/stacks/deploy.js
CHANGED
|
@@ -7,6 +7,7 @@ import { filterOutputs, isFailed, monitor, } from "./monitor.js";
|
|
|
7
7
|
import { VisibleError } from "../error.js";
|
|
8
8
|
export async function publishAssets(stacks) {
|
|
9
9
|
Logger.debug("Publishing assets");
|
|
10
|
+
const { cdk } = useProject().config;
|
|
10
11
|
const results = {};
|
|
11
12
|
for (const stackArtifact of stacks) {
|
|
12
13
|
const cfnStack = await getCloudFormationStack(stackArtifact);
|
|
@@ -15,7 +16,7 @@ export async function publishAssets(stacks) {
|
|
|
15
16
|
await buildAndPublishAssets(deployment, stackArtifact);
|
|
16
17
|
results[stackArtifact.stackName] = {
|
|
17
18
|
isUpdate: cfnStack && cfnStack.StackStatus !== "REVIEW_IN_PROGRESS",
|
|
18
|
-
params: await buildCloudFormationStackParams(deployment, stackArtifact),
|
|
19
|
+
params: await buildCloudFormationStackParams(deployment, stackArtifact, cdk),
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
return results;
|
|
@@ -87,7 +88,7 @@ export async function deploy(stack) {
|
|
|
87
88
|
cfnStack?.StackStatus === "ROLLBACK_FAILED") {
|
|
88
89
|
await deleteCloudFormationStack(stack.stackName);
|
|
89
90
|
}
|
|
90
|
-
const stackParams = await buildCloudFormationStackParams(deployment, stack);
|
|
91
|
+
const stackParams = await buildCloudFormationStackParams(deployment, stack, cdk);
|
|
91
92
|
try {
|
|
92
93
|
cfnStack && cfnStack.StackStatus !== "REVIEW_IN_PROGRESS"
|
|
93
94
|
? await updateCloudFormationStack(stackParams)
|
|
@@ -227,17 +228,20 @@ async function buildAndPublishAssets(deployment, stackArtifact) {
|
|
|
227
228
|
}
|
|
228
229
|
}
|
|
229
230
|
}
|
|
230
|
-
async function buildCloudFormationStackParams(deployment, stack) {
|
|
231
|
-
const
|
|
231
|
+
async function buildCloudFormationStackParams(deployment, stack, cdkOptions) {
|
|
232
|
+
const env = await deployment.envs.accessStackForMutableStackOperations(stack);
|
|
233
|
+
const executionRoleArn = cdkOptions?.cloudFormationExecutionRole ??
|
|
234
|
+
(await env.replacePlaceholders(stack.cloudFormationExecutionRoleArn));
|
|
232
235
|
const s3Url = stack
|
|
233
|
-
.stackTemplateAssetObjectUrl.replace("${AWS::AccountId}",
|
|
236
|
+
.stackTemplateAssetObjectUrl.replace("${AWS::AccountId}", env.resolvedEnvironment.account)
|
|
234
237
|
.match(/s3:\/\/([^/]+)\/(.*)$/);
|
|
235
238
|
const templateUrl = s3Url
|
|
236
|
-
? `https://s3.${
|
|
239
|
+
? `https://s3.${env.resolvedEnvironment.region}.amazonaws.com/${s3Url[1]}/${s3Url[2]}`
|
|
237
240
|
: stack.stackTemplateAssetObjectUrl;
|
|
238
241
|
return {
|
|
239
242
|
StackName: stack.stackName,
|
|
240
243
|
TemplateURL: templateUrl,
|
|
244
|
+
RoleARN: executionRoleArn,
|
|
241
245
|
//TemplateBody: bodyParameter.TemplateBody,
|
|
242
246
|
//Parameters: stackParams.apiParameters,
|
|
243
247
|
Parameters: [],
|
|
@@ -257,7 +261,7 @@ async function getCloudFormationStack(stack) {
|
|
|
257
261
|
const client = useAWSClient(CloudFormationClient);
|
|
258
262
|
try {
|
|
259
263
|
const { Stacks: stacks } = await client.send(new DescribeStacksCommand({
|
|
260
|
-
StackName: stack.
|
|
264
|
+
StackName: stack.stackName,
|
|
261
265
|
}));
|
|
262
266
|
if (!stacks || stacks.length === 0)
|
|
263
267
|
return;
|