Skip to content

Commit 0b736d7

Browse files
authored
fix: add stage to the export names in DpsStacItemGenerator (#73)
1 parent 0edb826 commit 0b736d7

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

cdk/PgStacInfra.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ export class PgStacInfra extends Stack {
505505
dpsStacItemGenConfig.allowedAccountBucketPairs,
506506
vpc,
507507
subnetSelection: apiSubnetSelection,
508+
stage,
508509
},
509510
);
510511

cdk/constructs/DpsStacItemGenerator/index.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ export interface DpsStacItemGeneratorProps {
104104
bucketArn: string;
105105
}>;
106106
readonly roleArn: string;
107+
108+
/**
109+
* Deployment stage for naming resources and exports.
110+
*
111+
* Used to create unique export names for each deployment stage,
112+
* allowing multiple stage deployments in the same account.
113+
*
114+
* @default "default"
115+
*/
116+
readonly stage?: string;
107117
}
108118

109119
export class DpsStacItemGenerator extends Construct {
@@ -143,6 +153,7 @@ export class DpsStacItemGenerator extends Construct {
143153
const timeoutSeconds = props.lambdaTimeoutSeconds ?? 120;
144154
const batchSize = props.batchSize ?? 10;
145155
const lambdaRuntime = props.lambdaRuntime ?? lambda.Runtime.PYTHON_3_12;
156+
const stage = props.stage ?? "default";
146157

147158
// Create dead letter queue
148159
this.deadLetterQueue = new sqs.Queue(this, "DeadLetterQueue", {
@@ -210,25 +221,25 @@ export class DpsStacItemGenerator extends Construct {
210221
new CfnOutput(this, "TopicArn", {
211222
value: this.topic.topicArn,
212223
description: "ARN of the DpsStacItemGenerator SNS Topic",
213-
exportName: "dps-stac-item-generator-topic-arn",
224+
exportName: `dps-stac-item-generator-topic-arn-${stage}`,
214225
});
215226

216227
new CfnOutput(this, "QueueUrl", {
217228
value: this.queue.queueUrl,
218229
description: "URL of the DpsStacItemGenerator SQS Queue",
219-
exportName: "dps-stac-item-generator-queue-url",
230+
exportName: `dps-stac-item-generator-queue-url-${stage}`,
220231
});
221232

222233
new CfnOutput(this, "DeadLetterQueueUrl", {
223234
value: this.deadLetterQueue.queueUrl,
224235
description: "URL of the DpsStacItemGenerator Dead Letter Queue",
225-
exportName: "dps-stac-item-generator-deadletter-queue-url",
236+
exportName: `dps-stac-item-generator-deadletter-queue-url-${stage}`,
226237
});
227238

228239
new CfnOutput(this, "FunctionName", {
229240
value: this.lambdaFunction.functionName,
230241
description: "Name of the DpsStacItemGenerator Lambda Function",
231-
exportName: "dps-stac-item-generator-function-name",
242+
exportName: `dps-stac-item-generator-function-name-${stage}`,
232243
});
233244
}
234245

0 commit comments

Comments
 (0)