@fjall/components-infrastructure 2.30.0 → 2.30.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/__tests__/setup.d.ts +48 -0
- package/dist/lib/__tests__/setup.js +1 -0
- package/dist/lib/config/aws/accountId.d.ts +6 -0
- package/dist/lib/config/aws/accountId.js +33 -0
- package/dist/lib/config/aws/backupGlobalSettings.d.ts +29 -0
- package/dist/lib/config/aws/backupGlobalSettings.js +51 -0
- package/dist/lib/config/aws/costAllocationTags.d.ts +12 -0
- package/dist/lib/config/aws/costAllocationTags.js +48 -0
- package/dist/lib/config/aws/eventBus.d.ts +7 -0
- package/dist/lib/config/aws/eventBus.js +24 -0
- package/dist/lib/config/aws/identityCenterGroupMembership.d.ts +10 -0
- package/dist/lib/config/aws/identityCenterGroupMembership.js +115 -0
- package/dist/lib/config/aws/ipamDelegateAdmin.d.ts +8 -0
- package/dist/lib/config/aws/ipamDelegateAdmin.js +58 -0
- package/dist/lib/config/aws/ipamPoolId.d.ts +10 -0
- package/dist/lib/config/aws/ipamPoolId.js +39 -0
- package/dist/lib/config/aws/organisation.d.ts +30 -0
- package/dist/lib/config/aws/organisation.js +95 -0
- package/dist/lib/config/aws/organisationId.d.ts +7 -0
- package/dist/lib/config/aws/organisationId.js +46 -0
- package/dist/lib/config/aws/organisationsAccess.d.ts +10 -0
- package/dist/lib/config/aws/organisationsAccess.js +50 -0
- package/dist/lib/config/aws/ramSharing.d.ts +4 -0
- package/dist/lib/config/aws/ramSharing.js +35 -0
- package/dist/lib/config/monitoring.d.ts +18 -0
- package/dist/lib/config/monitoring.js +22 -0
- package/dist/lib/patterns/aws/cicdRole.d.ts +67 -0
- package/dist/lib/patterns/aws/cicdRole.js +68 -0
- package/dist/lib/patterns/aws/compute.js +9 -0
- package/dist/lib/patterns/aws/computeLambda.d.ts +38 -3
- package/dist/lib/patterns/aws/computeLambda.js +29 -2
- package/dist/lib/patterns/aws/hostedZone.d.ts +28 -0
- package/dist/lib/patterns/aws/hostedZone.js +150 -0
- package/dist/lib/patterns/aws/managedAccount.d.ts +9 -0
- package/dist/lib/patterns/aws/managedAccount.js +55 -0
- package/dist/lib/patterns/aws/managedIdentityCenter.d.ts +4 -0
- package/dist/lib/patterns/aws/managedIdentityCenter.js +24 -0
- package/dist/lib/patterns/aws/managedOrganisation.d.ts +36 -0
- package/dist/lib/patterns/aws/managedOrganisation.js +97 -0
- package/dist/lib/patterns/aws/managedPlatform.d.ts +12 -0
- package/dist/lib/patterns/aws/managedPlatform.js +29 -0
- package/dist/lib/patterns/aws/subdomainHostedZone.d.ts +9 -0
- package/dist/lib/patterns/aws/subdomainHostedZone.js +39 -0
- package/dist/lib/resources/aws/cicd/cicdRole.d.ts +65 -0
- package/dist/lib/resources/aws/cicd/cicdRole.js +191 -0
- package/dist/lib/resources/aws/compute/ecsFreeTier.d.ts +75 -0
- package/dist/lib/resources/aws/compute/ecsFreeTier.js +1 -0
- package/dist/lib/resources/aws/compute/ecsImages.js +3 -25
- package/dist/lib/resources/aws/compute/ecsSpot.d.ts +75 -0
- package/dist/lib/resources/aws/compute/ecsSpot.js +1 -0
- package/dist/lib/resources/aws/compute/imageTagParameter.d.ts +12 -0
- package/dist/lib/resources/aws/compute/imageTagParameter.js +32 -0
- package/dist/lib/resources/aws/compute/utilities/capacityProviderDrainWaiter.d.ts +20 -0
- package/dist/lib/resources/aws/compute/utilities/capacityProviderDrainWaiter.js +1 -0
- package/dist/lib/resources/aws/database/database.d.ts +14 -0
- package/dist/lib/resources/aws/database/database.js +28 -0
- package/dist/lib/resources/aws/database/databaseInstance.d.ts +15 -0
- package/dist/lib/resources/aws/database/databaseInstance.js +30 -0
- package/dist/lib/resources/aws/iam/identityCenter/attachManagedPolicy.d.ts +13 -0
- package/dist/lib/resources/aws/iam/identityCenter/attachManagedPolicy.js +52 -0
- package/dist/lib/resources/aws/iam/securityGroup.d.ts +5 -0
- package/dist/lib/resources/aws/iam/securityGroup.js +14 -0
- package/dist/lib/resources/aws/monitoring/monitoringRole.d.ts +28 -0
- package/dist/lib/resources/aws/monitoring/monitoringRole.js +125 -0
- package/dist/lib/resources/aws/utilities/cfnOutput.d.ts +5 -0
- package/dist/lib/resources/aws/utilities/cfnOutput.js +1 -0
- package/dist/lib/utils/addSuffixToEmail.js +5 -1
- package/dist/lib/utils/capitalizeString.d.ts +1 -0
- package/dist/lib/utils/capitalizeString.js +7 -0
- package/package.json +4 -4
- package/dist/lib/config/aws/identityCenterMembership.d.ts +0 -11
- package/dist/lib/config/aws/identityCenterMembership.js +0 -61
|
@@ -1,29 +1,7 @@
|
|
|
1
|
-
import { CfnParameter, Stack } from "aws-cdk-lib";
|
|
2
1
|
import { ContainerImage } from "aws-cdk-lib/aws-ecs";
|
|
3
2
|
import { Repository } from "aws-cdk-lib/aws-ecr";
|
|
4
|
-
import { imageTagParameterName } from "@fjall/util";
|
|
5
3
|
import { DEFAULT_ECS_FALLBACK_IMAGE } from "./ecsConstants.js";
|
|
6
|
-
|
|
7
|
-
return `Image tag for ECS service ${serviceName}. Set by fjall deploy to the content-hash tag.`;
|
|
8
|
-
}
|
|
9
|
-
function getOrCreateImageTagParameter(ctx, serviceName) {
|
|
10
|
-
const stack = Stack.of(ctx.scope);
|
|
11
|
-
const paramLogicalId = imageTagParameterName(serviceName);
|
|
12
|
-
const description = buildImageTagDescription(serviceName);
|
|
13
|
-
const existing = stack.node.tryFindChild(paramLogicalId);
|
|
14
|
-
if (existing instanceof CfnParameter) {
|
|
15
|
-
if (existing.description !== description) {
|
|
16
|
-
throw new Error(`CfnParameter logical-ID collision: "${paramLogicalId}" is already registered for a different service. ` +
|
|
17
|
-
`Distinct service names cannot share a PascalCase identifier — rename one of the conflicting services.`);
|
|
18
|
-
}
|
|
19
|
-
return existing;
|
|
20
|
-
}
|
|
21
|
-
return new CfnParameter(stack, paramLogicalId, {
|
|
22
|
-
type: "String",
|
|
23
|
-
default: "latest",
|
|
24
|
-
description
|
|
25
|
-
});
|
|
26
|
-
}
|
|
4
|
+
import { getOrCreateImageTagParameter } from "./imageTagParameter.js";
|
|
27
5
|
export function getContainerImage(ctx, serviceName, containerConfig, serviceProps) {
|
|
28
6
|
const imageSource = containerConfig.image || serviceProps.image || ctx.props.ecrRepository;
|
|
29
7
|
if (!imageSource) {
|
|
@@ -36,11 +14,11 @@ export function getContainerImage(ctx, serviceName, containerConfig, serviceProp
|
|
|
36
14
|
if (isFullRegistryUrl) {
|
|
37
15
|
return ContainerImage.fromRegistry(imageSource);
|
|
38
16
|
}
|
|
39
|
-
const param = getOrCreateImageTagParameter(ctx, serviceName);
|
|
17
|
+
const param = getOrCreateImageTagParameter(ctx.scope, serviceName);
|
|
40
18
|
return ContainerImage.fromEcrRepository(Repository.fromRepositoryName(ctx.scope, `${serviceName}${containerConfig.name}EcrRepo`, imageSource), param.valueAsString);
|
|
41
19
|
}
|
|
42
20
|
if (imageSource instanceof Repository) {
|
|
43
|
-
const param = getOrCreateImageTagParameter(ctx, serviceName);
|
|
21
|
+
const param = getOrCreateImageTagParameter(ctx.scope, serviceName);
|
|
44
22
|
return ContainerImage.fromEcrRepository(imageSource, param.valueAsString);
|
|
45
23
|
}
|
|
46
24
|
return imageSource;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ContainerImage, type RepositoryImage } from "aws-cdk-lib/aws-ecs";
|
|
2
|
+
import { Connections, type IConnectable, type IVpc } from "aws-cdk-lib/aws-ec2";
|
|
3
|
+
import { Construct } from "constructs";
|
|
4
|
+
import { type StackBuilder } from "../base/awsStack";
|
|
5
|
+
import { type SecretValue } from "aws-cdk-lib";
|
|
6
|
+
import { type IManagedPolicy, PolicyDocument, Role } from "aws-cdk-lib/aws-iam";
|
|
7
|
+
import { Repository } from "aws-cdk-lib/aws-ecr";
|
|
8
|
+
import { type KeyValue } from "../../../types";
|
|
9
|
+
export declare enum ScalingType {
|
|
10
|
+
CPU = "ECSServiceAverageCPUUtilization",
|
|
11
|
+
MEMORY = "ECSServiceAverageMemoryUtilization"
|
|
12
|
+
}
|
|
13
|
+
export interface ContainerSecret {
|
|
14
|
+
[key: string]: SecretValue;
|
|
15
|
+
}
|
|
16
|
+
type Ec2ClusterProps = {
|
|
17
|
+
ecrRepository: Repository | RepositoryImage | string;
|
|
18
|
+
clusterName: string;
|
|
19
|
+
containerEntryPoint?: string[];
|
|
20
|
+
containerCommand?: string[];
|
|
21
|
+
containerEnvironment?: KeyValue;
|
|
22
|
+
containerSecrets?: ContainerSecret;
|
|
23
|
+
containerPort?: number;
|
|
24
|
+
cpu?: number;
|
|
25
|
+
parentDomain?: string;
|
|
26
|
+
desiredCount?: number;
|
|
27
|
+
healthCheckPath?: string;
|
|
28
|
+
listenerPort?: number;
|
|
29
|
+
memoryLimitMiB?: number;
|
|
30
|
+
publicLoadBalancer?: boolean;
|
|
31
|
+
scalingType?: ScalingType;
|
|
32
|
+
serviceName: string;
|
|
33
|
+
taskRoleInlinePolicies?: {
|
|
34
|
+
[name: string]: PolicyDocument;
|
|
35
|
+
};
|
|
36
|
+
taskRoleManagedPolicies?: IManagedPolicy[];
|
|
37
|
+
vpc?: IVpc;
|
|
38
|
+
};
|
|
39
|
+
export default class Ec2Cluster extends Construct implements IConnectable {
|
|
40
|
+
connections: Connections;
|
|
41
|
+
private cluster;
|
|
42
|
+
private autoScalingGroup;
|
|
43
|
+
private asgSecurityGroup;
|
|
44
|
+
private asgCapacityProvider;
|
|
45
|
+
private loadBalancer;
|
|
46
|
+
private loadBalancerSecurityGroup;
|
|
47
|
+
private loadBalancerListener;
|
|
48
|
+
private executionRole;
|
|
49
|
+
private taskDefinition;
|
|
50
|
+
private containerDefinition;
|
|
51
|
+
private ec2Service;
|
|
52
|
+
private scalingPolicy;
|
|
53
|
+
private hostedZone;
|
|
54
|
+
private certificate;
|
|
55
|
+
private aRecord;
|
|
56
|
+
private secrets;
|
|
57
|
+
constructor(scope: Construct, id: string, props: Ec2ClusterProps);
|
|
58
|
+
addCluster(props: Ec2ClusterProps): void;
|
|
59
|
+
addAutoScalingGroup(props: Ec2ClusterProps): void;
|
|
60
|
+
addSecrets(props: Ec2ClusterProps): void;
|
|
61
|
+
addExecutionRole(props: Ec2ClusterProps): void;
|
|
62
|
+
addTaskDefinition(props: Ec2ClusterProps): void;
|
|
63
|
+
addContainerDefinition(props: Ec2ClusterProps): void;
|
|
64
|
+
addEc2Service(props: Ec2ClusterProps): void;
|
|
65
|
+
addScalingPolicy(props: Ec2ClusterProps): void;
|
|
66
|
+
addLoadBalancer(props: Ec2ClusterProps): void;
|
|
67
|
+
removeAutoScalingGroup(): void;
|
|
68
|
+
addLoadBalancerListener(props: Ec2ClusterProps): void;
|
|
69
|
+
addHostedZone(props: Ec2ClusterProps): void;
|
|
70
|
+
registerLoadBalancerTargets(props: Ec2ClusterProps): void;
|
|
71
|
+
getImage(props: Ec2ClusterProps): ContainerImage;
|
|
72
|
+
getTaskRole(): Role | undefined;
|
|
73
|
+
static build(id: string, props: Ec2ClusterProps): (sb: StackBuilder) => Construct;
|
|
74
|
+
}
|
|
75
|
+
export {};
|