Skip to content

Commit ade2ca9

Browse files
authored
fix: remove env from generated infra sample code (#734)
1 parent 09420b6 commit ade2ca9

File tree

6 files changed

+24
-184
lines changed

6 files changed

+24
-184
lines changed

packages/infrastructure/samples/infrastructure/java/src/java/groupId/Main.java.mustache

+1-8
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,14 @@ import {{{groupId}}}.stacks.ApplicationStack;
1919
import java.util.Arrays;
2020

2121
import software.amazon.awscdk.App;
22-
import software.amazon.awscdk.Environment;
23-
import software.amazon.awscdk.StackProps;
2422

2523
public class Main {
2624
public static void main(final String[] args) {
2725
App app = PDKNag.app(PDKNagAppProps.builder()
2826
.nagPacks(Arrays.asList(new AwsPrototypingChecks()))
2927
.build());
3028
31-
new ApplicationStack(app, "{{{stackName}}}", StackProps.builder()
32-
.env(Environment.builder()
33-
.account(System.getenv("CDK_DEFAULT_ACCOUNT"))
34-
.region(System.getenv("CDK_DEFAULT_REGION"))
35-
.build())
36-
.build());
29+
new ApplicationStack(app, "{{{stackName}}}");
3730
3831
CdkGraph graph = new CdkGraph(app, ICdkGraphProps.builder()
3932
.plugins(Arrays.asList(

packages/infrastructure/samples/infrastructure/python/src/main.py.mustache

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
import os
2-
from aws_cdk import Environment
32
from aws_pdk.cdk_graph import CdkGraph, FilterPreset, Filters, IFilter, IGraphFilterPlan
43
from aws_pdk.cdk_graph_plugin_diagram import CdkGraphDiagramPlugin, IDiagramConfigBase
54
from aws_pdk.cdk_graph_plugin_threat_composer import CdkGraphThreatComposerPlugin
65
from aws_pdk.pdk_nag import PDKNag, AwsPrototypingChecks
76
from {{{moduleName}}}.stacks.application_stack import ApplicationStack
87

9-
# for development, use account/region from cdk cli
10-
dev_env = Environment(
11-
account=os.getenv('CDK_DEFAULT_ACCOUNT'),
12-
region=os.getenv('CDK_DEFAULT_REGION')
13-
)
14-
158
app = PDKNag.app(nag_packs=[AwsPrototypingChecks()])
16-
ApplicationStack(app, "{{{stackName}}}", env=dev_env)
9+
ApplicationStack(app, "{{{stackName}}}")
1710

1811
graph = CdkGraph(app, plugins=[
1912
CdkGraphDiagramPlugin(

packages/infrastructure/samples/infrastructure/typescript/src/main.ts.mustache

+1-7
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,13 @@ import { CdkGraphThreatComposerPlugin } from "@aws/pdk/cdk-graph-plugin-threat-c
44
import { AwsPrototypingChecks, PDKNag } from "@aws/pdk/pdk-nag";
55
import { ApplicationStack } from "./stacks/application-stack";
66

7-
// for development, use account/region from cdk cli
8-
const devEnv = {
9-
account: process.env.CDK_DEFAULT_ACCOUNT,
10-
region: process.env.CDK_DEFAULT_REGION,
11-
};
12-
137
/* eslint-disable @typescript-eslint/no-floating-promises */
148
(async () => {
159
const app = PDKNag.app({
1610
nagPacks: [new AwsPrototypingChecks()],
1711
});
1812

19-
new ApplicationStack(app, "{{{stackName}}}", { env: devEnv });
13+
new ApplicationStack(app, "{{{stackName}}}");
2014

2115
const graph = new CdkGraph(app, {
2216
plugins: [

packages/infrastructure/test/projects/java/__snapshots__/infrastructure-java-project.test.ts.snap

+7-56
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/infrastructure/test/projects/python/__snapshots__/infrastructure-py-project.test.ts.snap

+7-56
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)