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

[CDK-TS] Switch from creating new ASM secrets to referencing existing secret ARNs #24

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
15 changes: 7 additions & 8 deletions aws/cdk/typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This CDK application sets up Gatling Enterprise Private Locations and Packages i

Before deploying, ensure you have:
- A [Gatling Enterprise account](https://auth.gatling.io) with Private Locations enabled.
- A control plane [token](https://docs.gatling.io/reference/install/cloud/private-locations/introduction/#token).
- A control plane [token](https://docs.gatling.io/reference/install/cloud/private-locations/introduction/#token) stored in AWS Secrets Manager as a plaintext secret.
- Proper AWS credentials configured.

## Application Structure
Expand All @@ -28,8 +28,7 @@ The Control Plane stack configures networking, security, and storage for Gatling
```typescript
new ControlPlaneStack(app, stackName, {
// Possible values available on interface ControlPlaneProps in lib/interfaces/control-plane-interface.ts
token:
"token",
tokenSecretARN: "token-secret-ARN",
name: "gatling-pl",
description: "My AWS control plane description",
vpcId: "vpc-id",
Expand All @@ -42,12 +41,12 @@ new ControlPlaneStack(app, stackName, {
//cloudWatchLogs: true,
//useECR: false,
//enterpriseCloud: {
// url: "http://private-control-plane-forward-proxy/gatling"
//url: "http://private-control-plane-forward-proxy/gatling"
//}
});
```

- token (required): The control plane token for authentication.
- tokenSecretARN (required): AWS Secrets Manager Plaintext secret ARN of the stored control plane token.
- name (required): The name of the control plane.
- description: Description of the control plane.
- vpcId (required): VPC ID where the resources will be deployed.
Expand Down Expand Up @@ -78,9 +77,9 @@ const location = {
type: "certified"
},
engine: "classic"
enterprise-cloud: {
url: http://private-location-forward-proxy/gatling
}
//enterprise-cloud: {
//url: http://private-location-forward-proxy/gatling
//}
};
```

Expand Down
3 changes: 1 addition & 2 deletions aws/cdk/typescript/bin/private-location-package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ const location = {

new ControlPlaneStack(app, stackName, {
// Possible values available on interface ControlPlaneProps in lib/interfaces/control-plane-interface.ts
token:
"token",
tokenSecretARN: "token-secret-ARN",
name: "gatling-pl",
description: "My AWS control plane description",
vpcId: "vpc-id",
Expand Down
11 changes: 5 additions & 6 deletions aws/cdk/typescript/bin/private-location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@ const location = {
"security-groups": ["sg-id"],
"instance-type": "c7i.xlarge",
ami: {
type: "certified"
type: "certified",
},
engine: "classic",
//"enterprise-cloud": {
//url: "http://private-location-forward-proxy/gatling"
//url: "http://private-location-forward-proxy/gatling"
//}
};

new ControlPlaneStack(app, stackName, {
// Possible values available on interface ControlPlaneProps in lib/interfaces/control-plane-interface.ts
token:
"token",
name: "gatling-pl",
tokenSecretARN: "token-secret-ARN",
name: "control-plane",
description: "My AWS control plane description",
vpcId: "vpc-id",
availabilityZones: ["eu-west-3a", "eu-west-3b", "eu-west-3c"],
Expand All @@ -38,6 +37,6 @@ new ControlPlaneStack(app, stackName, {
//cloudWatchLogs: true,
//useECR: false,
//enterpriseCloud: {
//url: "http://private-location-forward-proxy/gatling"
//url: "http://private-location-forward-proxy/gatling"
//}
});
16 changes: 4 additions & 12 deletions aws/cdk/typescript/lib/control-plane.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Stack } from "aws-cdk-lib";
import "source-map-support/register";
import { Stack } from "aws-cdk-lib";
import { Construct } from "constructs";
import { ECSstack } from "./stacks/ecs-stack";
import { IAMstack } from "./stacks/iam-stack";
import { SecretsManagerStack } from "./stacks/secretsmanager-stack";
import { ControlPlaneProps } from "./interfaces/control-plane-interface";

export class ControlPlaneStack extends Stack {
Expand All @@ -12,11 +11,10 @@ export class ControlPlaneStack extends Stack {

const {
vpcId,
availabilityZones,
subnetIds,
availabilityZones,
securityGroupIds,
token,
tokenSecretName = "GatlingEnterprise/ControlPlane/Token",
tokenSecretARN,
name,
description,
image,
Expand All @@ -30,12 +28,6 @@ export class ControlPlaneStack extends Stack {
enterpriseCloud = {}
} = props;

const ControlPlaneSecret = new SecretsManagerStack(this, "sm", {
description: "Token for Gatling Enterprise control plane.",
secretName: tokenSecretName,
secretValue: token
});

const IAM = new IAMstack(this, "iam", {
name,
privatePackage,
Expand All @@ -54,7 +46,7 @@ export class ControlPlaneStack extends Stack {
image,
command,
environment,
secrets: { CONTROL_PLANE_TOKEN: ControlPlaneSecret.token, ...secrets },
secrets: { CONTROL_PLANE_TOKEN: tokenSecretARN, ...secrets },
locations,
privatePackage,
cloudWatchLogs,
Expand Down
3 changes: 1 addition & 2 deletions aws/cdk/typescript/lib/interfaces/control-plane-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ export interface ControlPlaneProps extends StackProps {
availabilityZones: string[];
subnetIds: string[];
securityGroupIds: string[];
token: string;
tokenSecretName?: string;
tokenSecretARN: string;
name: string;
description: string;
image: string;
Expand Down
3 changes: 1 addition & 2 deletions aws/cdk/typescript/lib/interfaces/ecs-interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { StackProps } from "aws-cdk-lib";
import { ISecret } from "aws-cdk-lib/aws-secretsmanager";
import { enterpriseCloud, Location, PrivatePackage } from "./common-interface";

export interface ECSstackProps extends StackProps {
Expand All @@ -13,7 +12,7 @@ export interface ECSstackProps extends StackProps {
image: string;
command?: string[];
environment?: Record<string, string>;
secrets?: Record<string, ISecret>;
secrets?: Record<string, string>;
locations: Location[];
privatePackage?: PrivatePackage;
cloudWatchLogs?: boolean;
Expand Down
7 changes: 0 additions & 7 deletions aws/cdk/typescript/lib/interfaces/secretsmanager-interface.ts

This file was deleted.

Loading