Skip to content

Commit

Permalink
Merge pull request #1353 from aligent/feature/add-name-props
Browse files Browse the repository at this point in the history
Add optional props for construct name
  • Loading branch information
gowrizrh authored May 6, 2024
2 parents ea16a27 + 0c75c5e commit dc1d19e
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions packages/graphql-mesh-server/lib/fargate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,34 @@ export interface MeshServiceProps {
* @default authentication-table
*/
authenticationTable?: string;

/**
* Specify a name for the ECS cluster
*
* @default - AWS generated cluster name
*/
clusterName?: string;

/**
* Specify a name for the GraphQL service
*
* @default - AWS generated service name
*/
serviceName?: string;

/**
* Specify a name for the ECR repository
*
* @default - AWS generated repository name
*/
repositoryName?: string;

/**
* Specify a name for the task definition family
*
* @default - AWS generated task definition family name
*/
taskDefinitionFamilyName?: string;
}

export class MeshService extends Construct {
Expand Down Expand Up @@ -171,6 +199,8 @@ export class MeshService extends Construct {
this.repository =
props.repository ||
new ecr.Repository(this, "repo", {
repositoryName:
props.repositoryName !== undefined ? props.repositoryName : undefined,
removalPolicy: RemovalPolicy.DESTROY,
autoDeleteImages: true,
});
Expand Down Expand Up @@ -219,6 +249,8 @@ export class MeshService extends Construct {
vpc: this.vpc,
containerInsights:
props.containerInsights !== undefined ? props.containerInsights : true,
clusterName:
props.clusterName !== undefined ? props.clusterName : undefined,
});

const environment: { [key: string]: string } = {};
Expand Down Expand Up @@ -267,6 +299,10 @@ export class MeshService extends Construct {
taskRole: new iam.Role(this, "MeshTaskRole", {
assumedBy: new iam.ServicePrincipal("ecs-tasks.amazonaws.com"),
}),
family:
props.taskDefinitionFamilyName !== undefined
? props.taskDefinitionFamilyName
: undefined,
},
publicLoadBalancer: true, // default,
taskSubnets: {
Expand Down
7 changes: 7 additions & 0 deletions packages/graphql-mesh-server/lib/graphql-mesh-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ export type MeshHostingProps = {
* @default true
*/
maintenanceAuthKey?: string;

/**
* Whether a DynamoDB table should be created to store session data
*
* @default authentication-table
*/
authenticationTable?: string;
};

export class MeshHosting extends Construct {
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-mesh-server/lib/maintenance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class Maintenance extends Construct {
});

efsVolumeSecGroup.addIngressRule(
Peer.anyIpv4(), // Can't get the IP address of each container as we don't know them at deploy time!
Peer.ipv4(props.vpc.vpcCidrBlock),
Port.tcp(2049),
"File access"
);
Expand Down
12 changes: 11 additions & 1 deletion packages/graphql-mesh-server/lib/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ export interface CodePipelineServiceProps {
* CloudFront distribution ID to clear cache on.
*/
cloudFrontDistributionId?: string;

/**
* Deployment pipeline name
*
* @default AWS CloudFormation generates an ID and uses that for the pipeline name
*/
pipelineName?: string;
}

export class CodePipelineService extends Construct {
Expand All @@ -56,7 +63,10 @@ export class CodePipelineService extends Construct {
constructor(scope: Construct, id: string, props: CodePipelineServiceProps) {
super(scope, id);

this.pipeline = new Pipeline(this, "deploy-pipeline");
this.pipeline = new Pipeline(this, "deploy-pipeline", {
pipelineName:
props.pipelineName !== undefined ? props.pipelineName : undefined,
});

const sourceOutput = new Artifact();
const sourceAction = new pipe_actions.EcrSourceAction({
Expand Down

0 comments on commit dc1d19e

Please sign in to comment.