Skip to content

Commit

Permalink
Refactor infra-stack and remove entrypoint file (#88)
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <[email protected]>
  • Loading branch information
gaiksaya authored Jan 5, 2024
1 parent 3acacd6 commit 71fa6ba
Show file tree
Hide file tree
Showing 6 changed files with 897 additions and 450 deletions.
26 changes: 24 additions & 2 deletions bin/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,34 @@ compatible open source license. */

import { App } from 'aws-cdk-lib';
import 'source-map-support/register';
import { OsClusterEntrypoint } from '../lib/os-cluster-entrypoint';
import { InfraStack } from '../lib/infra/infra-stack';
import { NetworkStack } from '../lib/networking/vpc-stack';

const app = new App();
const region = app.node.tryGetContext('region') ?? process.env.CDK_DEFAULT_REGION;
const account = app.node.tryGetContext('account') ?? process.env.CDK_DEFAULT_ACCOUNT;

new OsClusterEntrypoint(app, {
const suffix = `${app.node.tryGetContext('suffix')}`;
const networkStackSuffix = `${app.node.tryGetContext('networkStackSuffix')}`;

let networkStackName = 'opensearch-network-stack';
if (networkStackSuffix !== 'undefined') {
networkStackName = `opensearch-network-stack-${networkStackSuffix}`;
}
let infraStackName = 'opensearch-infra-stack';
if (suffix !== 'undefined') {
infraStackName = `opensearch-infra-stack-${suffix}`;
}

const networkStack = new NetworkStack(app, networkStackName, {
env: { account, region },
});

// @ts-ignore
const infraStack = new InfraStack(app, infraStackName, {
vpc: networkStack.vpc,
securityGroup: networkStack.osSecurityGroup,
env: { account, region },
});

infraStack.addDependency(networkStack);
Loading

0 comments on commit 71fa6ba

Please sign in to comment.