From 65bca0c85fc71510a452bd65601ccd3fa558d0be Mon Sep 17 00:00:00 2001 From: Eduard Jacobs Date: Mon, 3 Jan 2022 10:53:05 -0800 Subject: [PATCH 1/2] infrastructure stack --- lib/stack/index.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib/stack/index.ts b/lib/stack/index.ts index e69de29..4857f77 100644 --- a/lib/stack/index.ts +++ b/lib/stack/index.ts @@ -0,0 +1,26 @@ +import * as config from "@config"; +import * as cdk from "@aws-cdk/core"; +import { Resources } from "@pattern/Resources"; +import { EcsService } from "@pattern/EcsService"; + +export class Infrastructure extends cdk.Stack { + constructor(scope: cdk.Construct, id: string) { + super(scope, id); + + /** + * + * Base Resources + */ + const resources = new Resources(this, "Base-Resources"); + + /** + * + * Ecs Service + */ + new EcsService(this, "Ecs-Service", { + vpc: resources.vpc, + elb: resources.loadBalancer, + names: config.resource_names, + }); + } +} From 1ed8e1cfdf4f7f943b0e69109d949cf31391b5db Mon Sep 17 00:00:00 2001 From: Eduard Jacobs Date: Mon, 3 Jan 2022 10:58:33 -0800 Subject: [PATCH 2/2] ecs service minor change --- lib/pattern/EcsService/index.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/pattern/EcsService/index.ts b/lib/pattern/EcsService/index.ts index 2aa88c1..f86a243 100644 --- a/lib/pattern/EcsService/index.ts +++ b/lib/pattern/EcsService/index.ts @@ -24,6 +24,7 @@ export interface EcsServiceProps { } export class EcsService extends cdk.Construct { + public readonly applicationName: string; public readonly listeners: Listeners; public readonly targetGroups: TargetGroups; @@ -33,6 +34,7 @@ export class EcsService extends cdk.Construct { constructor(scope: cdk.Construct, id: string, props: EcsServiceProps) { super(scope, id); + this.applicationName = props.names.applicationName; /** * @@ -65,7 +67,7 @@ export class EcsService extends cdk.Construct { * Task Containers */ const container = new TaskContainer(this, "Task-Containers", { - appName: props.names.applicationName, + appName: this.applicationName, }); /** @@ -73,8 +75,8 @@ export class EcsService extends cdk.Construct { * Ecs Task Definition */ this.taskDef = new TaskDef(this, "Ecs-TaskDef", { + appName: this.applicationName, familyName: props.names.familyName, - appName: props.names.applicationName, taskContainers: container.allContainers, }); @@ -85,7 +87,7 @@ export class EcsService extends cdk.Construct { this.service = new Service(this, "Ecs-Service", { cluster: this.cluster, taskDefinition: this.taskDef, - serviceName: props.names.applicationName, + serviceName: this.applicationName, }); /**