Skip to content

Commit 659f9fc

Browse files
authored
Tools - Weathertop: Update plugin stacks to include EnvVars (#6948)
1 parent cf73ec2 commit 659f9fc

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed
File renamed without changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
{
3+
"name": "S3_BUCKET_NAME_PREFIX",
4+
"value": "sdk-example-code"
5+
}
6+
]

.tools/test/stacks/plugin/typescript/plugin_stack.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
3-
43
import * as cdk from "aws-cdk-lib";
54
import * as ec2 from "aws-cdk-lib/aws-ec2";
65
import * as events from "aws-cdk-lib/aws-events";
@@ -14,8 +13,9 @@ import * as sqs from "aws-cdk-lib/aws-sqs";
1413
import * as batch from "aws-cdk-lib/aws-batch";
1514
import * as subs from "aws-cdk-lib/aws-sns-subscriptions";
1615
import { Construct } from "constructs";
17-
import { readAccountConfig } from "../../config/types";
16+
import { readAccountConfig } from "../../config/targets";
1817
import { readResourceConfig } from "../../config/resources";
18+
import variableConfigJson from "../../config/variables.json";
1919

2020
const toolName = process.env.TOOL_NAME ?? "defaultToolName";
2121

@@ -31,20 +31,23 @@ class PluginStack extends cdk.Stack {
3131
const acctConfig = readAccountConfig("../../config/targets.yaml");
3232
const resourceConfig = readResourceConfig("../../config/resources.yaml");
3333

34-
const adminTopicName = resourceConfig["topic_name"];
35-
const adminBucketName = resourceConfig["bucket_name"];
3634
this.awsRegion = resourceConfig["aws_region"];
3735
this.adminAccountId = resourceConfig["admin_acct"];
36+
const adminTopicName = resourceConfig["topic_name"];
37+
const adminBucketName = resourceConfig["bucket_name"];
38+
3839
const snsTopic = this.initGetTopic(adminTopicName);
3940
const sqsQueue = new sqs.Queue(this, `BatchJobQueue-${toolName}`);
4041
if (acctConfig[`${toolName}`].status === "enabled") {
4142
this.initSubscribeSns(sqsQueue, snsTopic);
4243
this.batchMemory = acctConfig[`${toolName}`]?.memory ?? "16384";
4344
this.batchVcpus = acctConfig[`${toolName}`]?.vcpus ?? "4";
4445
}
46+
4547
const [jobDefinition, jobQueue] = this.initBatchFargate();
4648
const batchFunction = this.initBatchLambda(jobQueue, jobDefinition);
4749
this.initSqsLambdaIntegration(batchFunction, sqsQueue);
50+
4851
if (acctConfig[`${toolName}`].status === "enabled") {
4952
this.initLogFunction(adminBucketName);
5053
}
@@ -134,6 +137,7 @@ class PluginStack extends cdk.Stack {
134137
value: this.batchMemory,
135138
},
136139
],
140+
environment: variableConfigJson,
137141
},
138142
platformCapabilities: ["FARGATE"],
139143
});
@@ -211,7 +215,6 @@ class PluginStack extends cdk.Stack {
211215
resources: [sqsQueue.queueArn],
212216
}),
213217
);
214-
215218
// Additionally, ensure the Lambda function can create and write to CloudWatch Logs.
216219
lambdaFunction.addToRolePolicy(
217220
new iam.PolicyStatement({

.tools/test/stacks/plugin/typescript/tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"inlineSources": true,
1919
"experimentalDecorators": true,
2020
"strictPropertyInitialization": false,
21-
"typeRoots": ["./node_modules/@types"]
21+
"typeRoots": ["./node_modules/@types"],
22+
"resolveJsonModule": true,
23+
"esModuleInterop": true
2224
},
2325
"exclude": ["node_modules", "cdk.out"]
2426
}

0 commit comments

Comments
 (0)