Skip to content

Commit

Permalink
Merge pull request #7 from edo92/base
Browse files Browse the repository at this point in the history
Base
  • Loading branch information
edo92 authored Jan 3, 2022
2 parents 6e816e3 + 1ed8e1c commit 5c037e0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/pattern/EcsService/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

/**
*
Expand Down Expand Up @@ -65,16 +67,16 @@ export class EcsService extends cdk.Construct {
* Task Containers
*/
const container = new TaskContainer(this, "Task-Containers", {
appName: props.names.applicationName,
appName: this.applicationName,
});

/**
*
* Ecs Task Definition
*/
this.taskDef = new TaskDef(this, "Ecs-TaskDef", {
appName: this.applicationName,
familyName: props.names.familyName,
appName: props.names.applicationName,
taskContainers: container.allContainers,
});

Expand All @@ -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,
});

/**
Expand Down
26 changes: 26 additions & 0 deletions lib/stack/index.ts
Original file line number Diff line number Diff line change
@@ -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,
});
}
}

0 comments on commit 5c037e0

Please sign in to comment.