Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor infra-stack and remove entrypoint file #88

Merged
merged 5 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading