forked from aws-samples/aws-stf-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstf-core-stack.ts
58 lines (50 loc) · 1.98 KB
/
stf-core-stack.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { CfnOutput, Stack, StackProps } from 'aws-cdk-lib'
import { Construct } from 'constructs'
import { StfCoreScorpio } from './stacks/stf-core-scorpio/stf-core-scorpio'
import { StfIotStack } from './stacks/stf-core-iot/stf-core-iot-stack'
import { Parameters } from '../parameters'
import { StfCoreOrion } from './stacks/stf-core-orion/stf-core-orion'
import { StfCoreConstructs } from './stacks/stf-core-constructs/stf-core-constructs'
export class StfCoreStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props)
let stf_broker_stack;
let stf_iot_stack = null;
const stf_core_constructs = new StfCoreConstructs(this, 'CommonContructs')
if(Parameters.stf_broker == "Scorpio") {
stf_broker_stack = new StfCoreScorpio(this, 'Scorpio', {
vpc: stf_core_constructs.vpc,
secret: stf_core_constructs.secret
})
if (Parameters.deploy_iot) {
stf_iot_stack = new StfIotStack(this, 'IoT', {
dns_context_broker: stf_broker_stack.dns_context_broker,
vpc: stf_core_constructs.vpc,
api_ref: stf_broker_stack.api_ref,
})
}
} else if (Parameters.stf_broker == "Orion") {
stf_broker_stack = new StfCoreOrion(this, 'Orion', {
vpc: stf_core_constructs.vpc,
secret: stf_core_constructs.secret
})
if (Parameters.deploy_iot) {
stf_iot_stack = new StfIotStack(this, 'IoT', {
dns_context_broker: stf_broker_stack.dns_context_broker,
vpc: stf_core_constructs.vpc,
api_ref: stf_broker_stack.api_ref
})
}
} else {
throw new Error('Please provide a valid option for the context broker - Orion or Scorpio')
}
if (stf_iot_stack !== null) {
new CfnOutput(this, 'StfCoreEndpoint', {
value: stf_broker_stack.broker_api_endpoint
})
new CfnOutput(this, 'StfCoreIotQueueArn', {
value: stf_iot_stack.iot_sqs_endpoint_arn
})
}
}
}