@fjall/components-infrastructure 0.89.4 → 0.89.6
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/LICENSE +50 -21
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -18
- package/dist/lib/app.d.ts +12 -12
- package/dist/lib/app.js +61 -56
- package/dist/lib/aspects/index.d.ts +1 -1
- package/dist/lib/aspects/index.js +1 -6
- package/dist/lib/aspects/resourceInventory.js +6 -13
- package/dist/lib/config/audit.js +1 -5
- package/dist/lib/config/aws/accessAnalyser.d.ts +11 -0
- package/dist/lib/config/aws/accessAnalyser.js +17 -0
- package/dist/lib/config/aws/accountAuditRole.js +11 -15
- package/dist/lib/config/aws/accountMonitoringRole.js +25 -29
- package/dist/lib/config/aws/alarmTopic.d.ts +8 -0
- package/dist/lib/config/aws/alarmTopic.js +19 -0
- package/dist/lib/config/aws/cloudTrail.js +4 -9
- package/dist/lib/config/aws/configRecorder.d.ts +16 -0
- package/dist/lib/config/aws/configRecorder.js +51 -0
- package/dist/lib/config/aws/configRulePreset.d.ts +13 -0
- package/dist/lib/config/aws/configRulePreset.js +62 -0
- package/dist/lib/config/aws/disasterRecovery.d.ts +1 -1
- package/dist/lib/config/aws/disasterRecovery.js +56 -73
- package/dist/lib/config/aws/ebsDefaultEncryption.d.ts +8 -0
- package/dist/lib/config/aws/ebsDefaultEncryption.js +41 -0
- package/dist/lib/config/aws/ecrDefaultImage.js +25 -30
- package/dist/lib/config/aws/eventBus.js +8 -11
- package/dist/lib/config/aws/guardDutyDetector.d.ts +16 -0
- package/dist/lib/config/aws/guardDutyDetector.js +26 -0
- package/dist/lib/config/aws/identityCenter.d.ts +1 -1
- package/dist/lib/config/aws/identityCenter.js +23 -25
- package/dist/lib/config/aws/identityCenterGroupMembership.js +18 -22
- package/dist/lib/config/aws/index.d.ts +19 -8
- package/dist/lib/config/aws/index.js +19 -25
- package/dist/lib/config/aws/inspectorEnablement.d.ts +9 -0
- package/dist/lib/config/aws/inspectorEnablement.js +51 -0
- package/dist/lib/config/aws/ipam.js +9 -13
- package/dist/lib/config/aws/oidcConnector.js +8 -12
- package/dist/lib/config/aws/platform.js +1 -5
- package/dist/lib/config/aws/s3BlockPublicAccess.d.ts +9 -0
- package/dist/lib/config/aws/s3BlockPublicAccess.js +55 -0
- package/dist/lib/config/aws/scpPreset.d.ts +21 -0
- package/dist/lib/config/aws/scpPreset.js +311 -0
- package/dist/lib/config/aws/securityBaseline.d.ts +15 -0
- package/dist/lib/config/aws/securityBaseline.js +27 -0
- package/dist/lib/config/aws/securityHubHub.d.ts +15 -0
- package/dist/lib/config/aws/securityHubHub.js +28 -0
- package/dist/lib/config/aws/securityServicesAdmin.d.ts +20 -0
- package/dist/lib/config/aws/securityServicesAdmin.js +115 -0
- package/dist/lib/config/index.d.ts +2 -2
- package/dist/lib/config/index.js +2 -21
- package/dist/lib/index.d.ts +4 -4
- package/dist/lib/index.js +5 -26
- package/dist/lib/patterns/aws/account.d.ts +17 -1
- package/dist/lib/patterns/aws/account.js +61 -33
- package/dist/lib/patterns/aws/apexDomainPattern.d.ts +26 -0
- package/dist/lib/patterns/aws/apexDomainPattern.js +91 -0
- package/dist/lib/patterns/aws/auditRole.js +13 -16
- package/dist/lib/patterns/aws/buildkite.d.ts +1 -1
- package/dist/lib/patterns/aws/buildkite.js +70 -75
- package/dist/lib/patterns/aws/cdn.d.ts +5 -5
- package/dist/lib/patterns/aws/cdn.js +22 -28
- package/dist/lib/patterns/aws/compute.d.ts +1 -1
- package/dist/lib/patterns/aws/compute.js +31 -44
- package/dist/lib/patterns/aws/computeEc2.d.ts +1 -1
- package/dist/lib/patterns/aws/computeEc2.js +11 -14
- package/dist/lib/patterns/aws/computeEcs.d.ts +18 -2
- package/dist/lib/patterns/aws/computeEcs.js +41 -31
- package/dist/lib/patterns/aws/computeLambda.d.ts +2 -2
- package/dist/lib/patterns/aws/computeLambda.js +24 -31
- package/dist/lib/patterns/aws/database.d.ts +16 -7
- package/dist/lib/patterns/aws/database.js +81 -73
- package/dist/lib/patterns/aws/delegatedDomainPattern.d.ts +17 -0
- package/dist/lib/patterns/aws/delegatedDomainPattern.js +54 -0
- package/dist/lib/patterns/aws/dnsRecordComposer.d.ts +25 -0
- package/dist/lib/patterns/aws/dnsRecordComposer.js +225 -0
- package/dist/lib/patterns/aws/domain.d.ts +32 -0
- package/dist/lib/patterns/aws/domain.js +115 -0
- package/dist/lib/patterns/aws/domainDelegation.d.ts +3 -3
- package/dist/lib/patterns/aws/domainDelegation.js +28 -37
- package/dist/lib/patterns/aws/domainFactory.d.ts +20 -5
- package/dist/lib/patterns/aws/domainFactory.js +48 -10
- package/dist/lib/patterns/aws/domainValidation.d.ts +11 -0
- package/dist/lib/patterns/aws/domainValidation.js +145 -0
- package/dist/lib/patterns/aws/externalRecordsPattern.d.ts +18 -0
- package/dist/lib/patterns/aws/externalRecordsPattern.js +141 -0
- package/dist/lib/patterns/aws/fivetranProxy.d.ts +1 -1
- package/dist/lib/patterns/aws/fivetranProxy.js +6 -11
- package/dist/lib/patterns/aws/index.d.ts +21 -19
- package/dist/lib/patterns/aws/index.js +25 -36
- package/dist/lib/patterns/aws/interfaces/cdn.js +1 -5
- package/dist/lib/patterns/aws/interfaces/compute.js +4 -11
- package/dist/lib/patterns/aws/interfaces/connector.js +1 -15
- package/dist/lib/patterns/aws/interfaces/database.d.ts +1 -1
- package/dist/lib/patterns/aws/interfaces/database.js +6 -15
- package/dist/lib/patterns/aws/interfaces/domain.d.ts +80 -2
- package/dist/lib/patterns/aws/interfaces/domain.js +1 -6
- package/dist/lib/patterns/aws/interfaces/index.js +8 -41
- package/dist/lib/patterns/aws/interfaces/messaging.js +4 -11
- package/dist/lib/patterns/aws/interfaces/organisation.d.ts +1 -1
- package/dist/lib/patterns/aws/interfaces/organisation.js +4 -11
- package/dist/lib/patterns/aws/interfaces/pattern.js +2 -7
- package/dist/lib/patterns/aws/interfaces/storage.js +1 -5
- package/dist/lib/patterns/aws/managedIdentityCenter.js +7 -12
- package/dist/lib/patterns/aws/messaging.d.ts +7 -7
- package/dist/lib/patterns/aws/messaging.js +22 -33
- package/dist/lib/patterns/aws/network.d.ts +2 -2
- package/dist/lib/patterns/aws/network.js +9 -14
- package/dist/lib/patterns/aws/organisation.d.ts +6 -2
- package/dist/lib/patterns/aws/organisation.js +34 -35
- package/dist/lib/patterns/aws/organisationFactory.d.ts +3 -3
- package/dist/lib/patterns/aws/organisationFactory.js +7 -12
- package/dist/lib/patterns/aws/pattern.js +6 -12
- package/dist/lib/patterns/aws/payload.js +73 -63
- package/dist/lib/patterns/aws/platform.d.ts +6 -3
- package/dist/lib/patterns/aws/platform.js +15 -15
- package/dist/lib/patterns/aws/storage.d.ts +6 -4
- package/dist/lib/patterns/aws/storage.js +35 -40
- package/dist/lib/patterns/aws/subdomainHostedZone.js +11 -16
- package/dist/lib/patterns/aws/targets/fjallTargets.d.ts +37 -0
- package/dist/lib/patterns/aws/targets/fjallTargets.js +66 -0
- package/dist/lib/patterns/aws/targets/index.d.ts +2 -0
- package/dist/lib/patterns/aws/targets/index.js +2 -0
- package/dist/lib/patterns/aws/targets/targetResolution.d.ts +76 -0
- package/dist/lib/patterns/aws/targets/targetResolution.js +119 -0
- package/dist/lib/patterns/index.d.ts +1 -0
- package/dist/lib/patterns/index.js +1 -0
- package/dist/lib/resources/aws/analytics/clickhouse.d.ts +15 -0
- package/dist/lib/resources/aws/analytics/clickhouse.js +292 -0
- package/dist/lib/resources/aws/analytics/clickhouseConstants.d.ts +73 -0
- package/dist/lib/resources/aws/analytics/clickhouseConstants.js +87 -0
- package/dist/lib/resources/aws/analytics/clickhouseSecurityGroup.d.ts +13 -0
- package/dist/lib/resources/aws/analytics/clickhouseSecurityGroup.js +28 -0
- package/dist/lib/resources/aws/analytics/clickhouseTypes.d.ts +47 -0
- package/dist/lib/resources/aws/analytics/clickhouseTypes.js +1 -0
- package/dist/lib/resources/aws/analytics/clickhouseUserData.d.ts +5 -0
- package/dist/lib/resources/aws/analytics/clickhouseUserData.js +248 -0
- package/dist/lib/resources/aws/analytics/index.d.ts +2 -0
- package/dist/lib/resources/aws/analytics/index.js +1 -0
- package/dist/lib/resources/aws/audit/auditRole.js +10 -15
- package/dist/lib/resources/aws/audit/index.d.ts +1 -1
- package/dist/lib/resources/aws/audit/index.js +1 -6
- package/dist/lib/resources/aws/backup/backupPlan.d.ts +1 -1
- package/dist/lib/resources/aws/backup/backupPlan.js +14 -16
- package/dist/lib/resources/aws/backup/backupVault.d.ts +1 -1
- package/dist/lib/resources/aws/backup/backupVault.js +13 -15
- package/dist/lib/resources/aws/backup/index.d.ts +2 -2
- package/dist/lib/resources/aws/backup/index.js +2 -19
- package/dist/lib/resources/aws/base/awsStack.js +17 -19
- package/dist/lib/resources/aws/base/index.d.ts +1 -1
- package/dist/lib/resources/aws/base/index.js +1 -18
- package/dist/lib/resources/aws/cdn/cloudFront.js +40 -42
- package/dist/lib/resources/aws/cdn/index.d.ts +1 -1
- package/dist/lib/resources/aws/cdn/index.js +1 -18
- package/dist/lib/resources/aws/compute/ec2.js +39 -39
- package/dist/lib/resources/aws/compute/ecs.d.ts +18 -396
- package/dist/lib/resources/aws/compute/ecs.js +105 -976
- package/dist/lib/resources/aws/compute/ecsCapacityProviderAspect.d.ts +22 -0
- package/dist/lib/resources/aws/compute/ecsCapacityProviderAspect.js +35 -0
- package/dist/lib/resources/aws/compute/ecsConstants.d.ts +20 -0
- package/dist/lib/resources/aws/compute/ecsConstants.js +49 -0
- package/dist/lib/resources/aws/compute/ecsContext.d.ts +12 -0
- package/dist/lib/resources/aws/compute/ecsContext.js +1 -0
- package/dist/lib/resources/aws/compute/ecsImages.d.ts +4 -0
- package/dist/lib/resources/aws/compute/ecsImages.js +35 -0
- package/dist/lib/resources/aws/compute/ecsNetworking.d.ts +28 -0
- package/dist/lib/resources/aws/compute/ecsNetworking.js +290 -0
- package/dist/lib/resources/aws/compute/ecsRoles.d.ts +15 -0
- package/dist/lib/resources/aws/compute/ecsRoles.js +110 -0
- package/dist/lib/resources/aws/compute/ecsServiceFactory.d.ts +33 -0
- package/dist/lib/resources/aws/compute/ecsServiceFactory.js +183 -0
- package/dist/lib/resources/aws/compute/ecsTaskDefinition.d.ts +30 -0
- package/dist/lib/resources/aws/compute/ecsTaskDefinition.js +168 -0
- package/dist/lib/resources/aws/compute/ecsTypes.d.ts +337 -0
- package/dist/lib/resources/aws/compute/ecsTypes.js +10 -0
- package/dist/lib/resources/aws/compute/ecsValidation.d.ts +18 -0
- package/dist/lib/resources/aws/compute/ecsValidation.js +72 -0
- package/dist/lib/resources/aws/compute/index.d.ts +3 -3
- package/dist/lib/resources/aws/compute/index.js +3 -20
- package/dist/lib/resources/aws/compute/lambda.d.ts +10 -2
- package/dist/lib/resources/aws/compute/lambda.js +82 -70
- package/dist/lib/resources/aws/database/dynamodb.js +27 -28
- package/dist/lib/resources/aws/database/index.d.ts +7 -7
- package/dist/lib/resources/aws/database/index.js +14 -33
- package/dist/lib/resources/aws/database/rdsAurora.d.ts +10 -2
- package/dist/lib/resources/aws/database/rdsAurora.js +76 -61
- package/dist/lib/resources/aws/database/rdsAuroraGlobal.d.ts +2 -2
- package/dist/lib/resources/aws/database/rdsAuroraGlobal.js +24 -21
- package/dist/lib/resources/aws/database/rdsDefaults.js +3 -7
- package/dist/lib/resources/aws/database/rdsHelpers.d.ts +2 -2
- package/dist/lib/resources/aws/database/rdsHelpers.js +21 -29
- package/dist/lib/resources/aws/database/rdsInstance.d.ts +11 -3
- package/dist/lib/resources/aws/database/rdsInstance.js +101 -83
- package/dist/lib/resources/aws/database/rdsProxyOutput.js +5 -9
- package/dist/lib/resources/aws/iam/delegationRole.d.ts +18 -0
- package/dist/lib/resources/aws/iam/delegationRole.js +60 -0
- package/dist/lib/resources/aws/iam/identityCenter/assignment.js +4 -9
- package/dist/lib/resources/aws/iam/identityCenter/group.js +5 -9
- package/dist/lib/resources/aws/iam/identityCenter/index.d.ts +3 -3
- package/dist/lib/resources/aws/iam/identityCenter/index.js +3 -20
- package/dist/lib/resources/aws/iam/identityCenter/permissionSet.d.ts +1 -1
- package/dist/lib/resources/aws/iam/identityCenter/permissionSet.js +5 -9
- package/dist/lib/resources/aws/iam/index.d.ts +5 -4
- package/dist/lib/resources/aws/iam/index.js +5 -21
- package/dist/lib/resources/aws/iam/instanceProfile.js +2 -7
- package/dist/lib/resources/aws/iam/managedPolicy.js +2 -7
- package/dist/lib/resources/aws/iam/policy.js +2 -7
- package/dist/lib/resources/aws/iam/role.js +2 -7
- package/dist/lib/resources/aws/index.d.ts +7 -7
- package/dist/lib/resources/aws/index.js +7 -24
- package/dist/lib/resources/aws/logging/cloudTrail.d.ts +1 -1
- package/dist/lib/resources/aws/logging/cloudTrail.js +18 -22
- package/dist/lib/resources/aws/logging/index.d.ts +2 -2
- package/dist/lib/resources/aws/logging/index.js +2 -19
- package/dist/lib/resources/aws/logging/logGroup.js +4 -10
- package/dist/lib/resources/aws/messaging/eventbridge.js +11 -14
- package/dist/lib/resources/aws/messaging/index.d.ts +4 -4
- package/dist/lib/resources/aws/messaging/index.js +4 -21
- package/dist/lib/resources/aws/messaging/sns.js +11 -14
- package/dist/lib/resources/aws/messaging/sqs.js +32 -34
- package/dist/lib/resources/aws/messaging/utils.d.ts +1 -1
- package/dist/lib/resources/aws/messaging/utils.js +1 -6
- package/dist/lib/resources/aws/monitoring/alarmDefaults.d.ts +36 -0
- package/dist/lib/resources/aws/monitoring/alarmDefaults.js +34 -0
- package/dist/lib/resources/aws/monitoring/ecsAlarms.d.ts +21 -0
- package/dist/lib/resources/aws/monitoring/ecsAlarms.js +88 -0
- package/dist/lib/resources/aws/monitoring/index.d.ts +4 -0
- package/dist/lib/resources/aws/monitoring/index.js +4 -5
- package/dist/lib/resources/aws/monitoring/lambdaAlarms.d.ts +18 -0
- package/dist/lib/resources/aws/monitoring/lambdaAlarms.js +44 -0
- package/dist/lib/resources/aws/monitoring/rdsAlarms.d.ts +20 -0
- package/dist/lib/resources/aws/monitoring/rdsAlarms.js +52 -0
- package/dist/lib/resources/aws/networking/crossAccountDelegationRecord.d.ts +17 -0
- package/dist/lib/resources/aws/networking/crossAccountDelegationRecord.js +26 -0
- package/dist/lib/resources/aws/networking/dnsRecord/aRecord.d.ts +12 -0
- package/dist/lib/resources/aws/networking/dnsRecord/aRecord.js +21 -0
- package/dist/lib/resources/aws/networking/dnsRecord/aaaaRecord.d.ts +12 -0
- package/dist/lib/resources/aws/networking/dnsRecord/aaaaRecord.js +22 -0
- package/dist/lib/resources/aws/networking/dnsRecord/aliasRecord.d.ts +12 -0
- package/dist/lib/resources/aws/networking/dnsRecord/aliasRecord.js +23 -0
- package/dist/lib/resources/aws/networking/dnsRecord/caaRecord.d.ts +17 -0
- package/dist/lib/resources/aws/networking/dnsRecord/caaRecord.js +21 -0
- package/dist/lib/resources/aws/networking/dnsRecord/cnameRecord.d.ts +12 -0
- package/dist/lib/resources/aws/networking/dnsRecord/cnameRecord.js +22 -0
- package/dist/lib/resources/aws/networking/dnsRecord/dnsRecordBase.d.ts +17 -0
- package/dist/lib/resources/aws/networking/dnsRecord/dnsRecordBase.js +17 -0
- package/dist/lib/resources/aws/networking/dnsRecord/index.d.ts +10 -0
- package/dist/lib/resources/aws/networking/dnsRecord/index.js +10 -0
- package/dist/lib/resources/aws/networking/dnsRecord/mxRecord.d.ts +16 -0
- package/dist/lib/resources/aws/networking/dnsRecord/mxRecord.js +21 -0
- package/dist/lib/resources/aws/networking/dnsRecord/nsRecord.d.ts +12 -0
- package/dist/lib/resources/aws/networking/dnsRecord/nsRecord.js +21 -0
- package/dist/lib/resources/aws/networking/dnsRecord/srvRecord.d.ts +18 -0
- package/dist/lib/resources/aws/networking/dnsRecord/srvRecord.js +21 -0
- package/dist/lib/resources/aws/networking/dnsRecord/txtRecord.d.ts +12 -0
- package/dist/lib/resources/aws/networking/dnsRecord/txtRecord.js +21 -0
- package/dist/lib/resources/aws/networking/domain.d.ts +1 -1
- package/dist/lib/resources/aws/networking/domain.js +32 -34
- package/dist/lib/resources/aws/networking/domainCertificate.d.ts +8 -3
- package/dist/lib/resources/aws/networking/domainCertificate.js +22 -16
- package/dist/lib/resources/aws/networking/hostedZone.d.ts +23 -19
- package/dist/lib/resources/aws/networking/hostedZone.js +70 -134
- package/dist/lib/resources/aws/networking/index.d.ts +8 -7
- package/dist/lib/resources/aws/networking/index.js +8 -24
- package/dist/lib/resources/aws/networking/ipam.js +2 -7
- package/dist/lib/resources/aws/networking/ipamPool.d.ts +1 -1
- package/dist/lib/resources/aws/networking/ipamPool.js +45 -55
- package/dist/lib/resources/aws/networking/securityGroup.js +2 -7
- package/dist/lib/resources/aws/networking/vpc.d.ts +1 -1
- package/dist/lib/resources/aws/networking/vpc.js +17 -21
- package/dist/lib/resources/aws/organisation/costAllocationTagActivator.d.ts +1 -1
- package/dist/lib/resources/aws/organisation/costAllocationTagActivator.js +11 -15
- package/dist/lib/resources/aws/organisation/index.d.ts +5 -5
- package/dist/lib/resources/aws/organisation/index.js +4 -12
- package/dist/lib/resources/aws/organisation/organisation.js +5 -7
- package/dist/lib/resources/aws/organisation/organisationAccount.js +7 -10
- package/dist/lib/resources/aws/organisation/organisationPolicy.js +5 -9
- package/dist/lib/resources/aws/organisation/organisationalUnit.js +1 -3
- package/dist/lib/resources/aws/secrets/alias.js +2 -7
- package/dist/lib/resources/aws/secrets/index.d.ts +4 -4
- package/dist/lib/resources/aws/secrets/index.js +4 -21
- package/dist/lib/resources/aws/secrets/kms.js +15 -18
- package/dist/lib/resources/aws/secrets/parameter.d.ts +3 -3
- package/dist/lib/resources/aws/secrets/parameter.js +19 -22
- package/dist/lib/resources/aws/secrets/secret.d.ts +2 -2
- package/dist/lib/resources/aws/secrets/secret.js +12 -14
- package/dist/lib/resources/aws/storage/ecr.d.ts +2 -2
- package/dist/lib/resources/aws/storage/ecr.js +7 -13
- package/dist/lib/resources/aws/storage/index.d.ts +2 -2
- package/dist/lib/resources/aws/storage/index.js +2 -19
- package/dist/lib/resources/aws/storage/s3.d.ts +1 -1
- package/dist/lib/resources/aws/storage/s3.js +24 -12
- package/dist/lib/resources/aws/utilities/awsCustomResource.js +3 -7
- package/dist/lib/resources/aws/utilities/codeBuild.js +7 -12
- package/dist/lib/resources/aws/utilities/customResource.js +14 -17
- package/dist/lib/resources/aws/utilities/customResourceProvider.js +2 -7
- package/dist/lib/resources/aws/utilities/index.d.ts +5 -5
- package/dist/lib/resources/aws/utilities/index.js +5 -22
- package/dist/lib/resources/aws/utilities/resourceShare.js +2 -7
- package/dist/lib/resources/index.d.ts +1 -1
- package/dist/lib/resources/index.js +1 -18
- package/dist/lib/types.js +1 -3
- package/dist/lib/utils/accountsUtils.d.ts +5 -0
- package/dist/lib/utils/accountsUtils.js +18 -0
- package/dist/lib/utils/addSuffixToEmail.js +1 -5
- package/dist/lib/utils/backupTierMapping.js +2 -6
- package/dist/lib/utils/capitaliseString.js +1 -10
- package/dist/lib/utils/connections.js +9 -13
- package/dist/lib/utils/connector.js +10 -23
- package/dist/lib/utils/constructMap.d.ts +33 -0
- package/dist/lib/utils/constructMap.js +154 -0
- package/dist/lib/utils/databaseTypes.js +4 -10
- package/dist/lib/utils/dnsRecords.d.ts +1 -1
- package/dist/lib/utils/dnsRecords.js +23 -27
- package/dist/lib/utils/domainTypes.d.ts +0 -1
- package/dist/lib/utils/domainTypes.js +2 -10
- package/dist/lib/utils/env.js +14 -26
- package/dist/lib/utils/getAccountId.js +3 -7
- package/dist/lib/utils/getAsync.js +7 -10
- package/dist/lib/utils/getConfig.d.ts +0 -2
- package/dist/lib/utils/getConfig.js +29 -47
- package/dist/lib/utils/getStackOutput.js +4 -8
- package/dist/lib/utils/index.d.ts +12 -12
- package/dist/lib/utils/index.js +12 -29
- package/dist/lib/utils/manifestWriter.d.ts +14 -3
- package/dist/lib/utils/manifestWriter.js +60 -43
- package/dist/lib/utils/orgConfigParser.d.ts +14 -0
- package/dist/lib/utils/orgConfigParser.js +49 -0
- package/dist/lib/utils/removalPolicy.js +5 -9
- package/dist/lib/utils/resourceNaming.js +11 -16
- package/dist/lib/utils/standardTagsAspect.js +9 -16
- package/dist/lib/utils/stripAndCamelCase.js +1 -5
- package/dist/lib/utils/validationLogger.js +12 -18
- package/dist/lib/utils/vpcUtils.js +5 -10
- package/package.json +25 -8
- package/dist/lib/config/aws/accountId.d.ts +0 -6
- package/dist/lib/config/aws/accountId.js +0 -32
- package/dist/lib/config/aws/backupGlobalSettings.d.ts +0 -29
- package/dist/lib/config/aws/backupGlobalSettings.js +0 -49
- package/dist/lib/config/aws/costAllocationTags.d.ts +0 -12
- package/dist/lib/config/aws/costAllocationTags.js +0 -47
- package/dist/lib/config/aws/ipamDelegateAdmin.d.ts +0 -8
- package/dist/lib/config/aws/ipamDelegateAdmin.js +0 -57
- package/dist/lib/config/aws/ipamPoolId.d.ts +0 -16
- package/dist/lib/config/aws/ipamPoolId.js +0 -42
- package/dist/lib/config/aws/organisation.d.ts +0 -30
- package/dist/lib/config/aws/organisation.js +0 -92
- package/dist/lib/config/aws/organisationId.d.ts +0 -7
- package/dist/lib/config/aws/organisationId.js +0 -45
- package/dist/lib/config/aws/organisationsAccess.d.ts +0 -10
- package/dist/lib/config/aws/organisationsAccess.js +0 -49
- package/dist/lib/config/aws/ramSharing.d.ts +0 -4
- package/dist/lib/config/aws/ramSharing.js +0 -34
- package/dist/lib/config/monitoring.d.ts +0 -18
- package/dist/lib/config/monitoring.js +0 -22
- package/dist/lib/patterns/aws/connections.d.ts +0 -46
- package/dist/lib/patterns/aws/connections.js +0 -159
- package/dist/lib/patterns/aws/hostedZone.d.ts +0 -28
- package/dist/lib/patterns/aws/hostedZone.js +0 -150
- package/dist/lib/patterns/aws/managedAccount.d.ts +0 -9
- package/dist/lib/patterns/aws/managedAccount.js +0 -55
- package/dist/lib/patterns/aws/managedOrganisation.d.ts +0 -36
- package/dist/lib/patterns/aws/managedOrganisation.js +0 -97
- package/dist/lib/patterns/aws/managedPlatform.d.ts +0 -12
- package/dist/lib/patterns/aws/managedPlatform.js +0 -29
- package/dist/lib/resources/aws/database/database.d.ts +0 -14
- package/dist/lib/resources/aws/database/database.js +0 -28
- package/dist/lib/resources/aws/database/databaseInstance.d.ts +0 -15
- package/dist/lib/resources/aws/database/databaseInstance.js +0 -30
- package/dist/lib/resources/aws/database/migrationLambda.d.ts +0 -80
- package/dist/lib/resources/aws/database/migrationLambda.js +0 -119
- package/dist/lib/resources/aws/iam/identityCenter/attachManagedPolicy.d.ts +0 -13
- package/dist/lib/resources/aws/iam/identityCenter/attachManagedPolicy.js +0 -51
- package/dist/lib/resources/aws/iam/securityGroup.d.ts +0 -5
- package/dist/lib/resources/aws/iam/securityGroup.js +0 -14
- package/dist/lib/resources/aws/monitoring/monitoringRole.d.ts +0 -29
- package/dist/lib/resources/aws/monitoring/monitoringRole.js +0 -120
- package/dist/lib/utils/capitalizeString.d.ts +0 -12
- package/dist/lib/utils/capitalizeString.js +0 -30
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { type ContainerDefinition, type RepositoryImage } from "aws-cdk-lib/aws-ecs";
|
|
2
|
+
import { type IVpc } from "aws-cdk-lib/aws-ec2";
|
|
3
|
+
import { type IManagedPolicy, type PolicyDocument } from "aws-cdk-lib/aws-iam";
|
|
4
|
+
import { type TargetTrackingScalingPolicy } from "aws-cdk-lib/aws-applicationautoscaling";
|
|
5
|
+
import { type GeoLocation } from "aws-cdk-lib/aws-route53";
|
|
6
|
+
import { type Repository } from "aws-cdk-lib/aws-ecr";
|
|
7
|
+
import { type FargateService, type Ec2Service, type FargateTaskDefinition, type Ec2TaskDefinition } from "aws-cdk-lib/aws-ecs";
|
|
8
|
+
import { type IApplicationTargetGroup } from "aws-cdk-lib/aws-elasticloadbalancingv2";
|
|
9
|
+
import { type Role } from "aws-cdk-lib/aws-iam";
|
|
10
|
+
import { type HostedZone as FjallHostedZone } from "../networking/hostedZone.js";
|
|
11
|
+
import { type Certificate } from "aws-cdk-lib/aws-certificatemanager";
|
|
12
|
+
import { type ConnectionSpec } from "../../../utils/connector.js";
|
|
13
|
+
import { type SecretImport } from "../secrets/index.js";
|
|
14
|
+
import type { ManagedDomainExports } from "../../../utils/domainTypes.js";
|
|
15
|
+
import type { ITopic } from "aws-cdk-lib/aws-sns";
|
|
16
|
+
import type { EcsServiceAlarmThresholds } from "../monitoring/index.js";
|
|
17
|
+
export declare enum Protocol {
|
|
18
|
+
HTTP = 0,
|
|
19
|
+
HTTPS = 1
|
|
20
|
+
}
|
|
21
|
+
export declare enum ScalingType {
|
|
22
|
+
CPU = "ECSServiceAverageCPUUtilization",
|
|
23
|
+
MEMORY = "ECSServiceAverageMemoryUtilization"
|
|
24
|
+
}
|
|
25
|
+
export type EcsCapacityProvider = "FARGATE" | "FARGATE_SPOT" | "EC2";
|
|
26
|
+
/**
|
|
27
|
+
* EC2 capacity configuration for ECS EC2-backed clusters.
|
|
28
|
+
* Only used when capacityProvider is "EC2".
|
|
29
|
+
*/
|
|
30
|
+
export interface Ec2CapacityConfig {
|
|
31
|
+
/** EC2 instance type. Default: "t4g.micro" */
|
|
32
|
+
instanceType?: string;
|
|
33
|
+
/** AMI hardware type. Default: "ARM" (Graviton - better cost/performance) */
|
|
34
|
+
amiHardwareType?: "ARM" | "STANDARD";
|
|
35
|
+
/** Minimum number of instances. Default: 2 */
|
|
36
|
+
minCapacity?: number;
|
|
37
|
+
/** Maximum number of instances. Default: 3 */
|
|
38
|
+
maxCapacity?: number;
|
|
39
|
+
/** Memory limit in MiB for the container. Default: 1024 */
|
|
40
|
+
memoryLimitMiB?: number;
|
|
41
|
+
/** Warm pool keeps stopped instances for faster start (10-15s vs 60-90s).
|
|
42
|
+
* Mirrors generator WarmPool type (generator/src/schemas/computeSchemas.ts). */
|
|
43
|
+
warmPool?: {
|
|
44
|
+
/** Minimum instances to keep in the warm pool. Default: 1 */
|
|
45
|
+
minSize?: number;
|
|
46
|
+
/** Return instances to the pool on scale-in instead of terminating. Default: true */
|
|
47
|
+
reuseOnScaleIn?: boolean;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Domain configuration for HTTPS and DNS.
|
|
52
|
+
*/
|
|
53
|
+
export interface DomainBaseConfig {
|
|
54
|
+
domainName: string;
|
|
55
|
+
hostedZone?: FjallHostedZone;
|
|
56
|
+
certificate?: Certificate;
|
|
57
|
+
setIdentifier?: string;
|
|
58
|
+
/** Import zone and cert from a managed domain stack via Fn.importValue() */
|
|
59
|
+
managedDomain?: ManagedDomainExports;
|
|
60
|
+
}
|
|
61
|
+
export interface LatencyDomainConfig extends DomainBaseConfig {
|
|
62
|
+
region: string;
|
|
63
|
+
}
|
|
64
|
+
export interface WeightedDomainConfig extends DomainBaseConfig {
|
|
65
|
+
weight: number;
|
|
66
|
+
}
|
|
67
|
+
export interface GeoLocationDomainConfig extends DomainBaseConfig {
|
|
68
|
+
geoLocation: GeoLocation;
|
|
69
|
+
}
|
|
70
|
+
export type DomainConfig = DomainBaseConfig | LatencyDomainConfig | WeightedDomainConfig | GeoLocationDomainConfig;
|
|
71
|
+
/**
|
|
72
|
+
* Internal configuration for a container in a multi-container ECS task.
|
|
73
|
+
*
|
|
74
|
+
* In multi-container tasks, the first container with a `port` is the **primary container**
|
|
75
|
+
* that receives load balancer traffic. All other containers are **sidecars** that provide
|
|
76
|
+
* supporting functionality (logging, monitoring, proxies, etc.).
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* // Primary container (has port) + sidecar (no port)
|
|
80
|
+
* containers: [
|
|
81
|
+
* { name: "app", port: 3000 }, // Primary - receives ALB traffic
|
|
82
|
+
* { name: "datadog", image: "datadog/agent" } // Sidecar - monitoring
|
|
83
|
+
* ]
|
|
84
|
+
*
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
export interface EcsClusterContainerConfig {
|
|
88
|
+
/** Unique container name */
|
|
89
|
+
name: string;
|
|
90
|
+
/**
|
|
91
|
+
* Container image. Options:
|
|
92
|
+
* - Omit: Uses default ECR repository (primary container only)
|
|
93
|
+
* - string: ECR repository name or public image URL
|
|
94
|
+
* - Repository: CDK ECR Repository construct
|
|
95
|
+
*/
|
|
96
|
+
image?: string | Repository;
|
|
97
|
+
/**
|
|
98
|
+
* Port the container listens on.
|
|
99
|
+
* The first container with a port becomes the **primary container**
|
|
100
|
+
* and is registered with the load balancer.
|
|
101
|
+
*/
|
|
102
|
+
port?: number;
|
|
103
|
+
/** Environment variables */
|
|
104
|
+
environment?: Record<string, string>;
|
|
105
|
+
/**
|
|
106
|
+
* Secrets from AWS SSM Parameter Store.
|
|
107
|
+
* Array of secret names that will be fetched from the service's SSM namespace.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* secrets: ["API_KEY", "DB_PASSWORD"]
|
|
111
|
+
*/
|
|
112
|
+
secrets?: string[];
|
|
113
|
+
/** Secrets imported from other CDK resources (AWS Secrets Manager) */
|
|
114
|
+
secretsImport?: {
|
|
115
|
+
[key: string]: SecretImport;
|
|
116
|
+
};
|
|
117
|
+
/** Command to run in the container */
|
|
118
|
+
command?: string[];
|
|
119
|
+
/** Entry point for the container */
|
|
120
|
+
entryPoint?: string[];
|
|
121
|
+
/**
|
|
122
|
+
* Whether this container is essential.
|
|
123
|
+
* If an essential container stops, all containers in the task stop.
|
|
124
|
+
* Default: true for primary container, true for sidecars
|
|
125
|
+
*/
|
|
126
|
+
essential?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Health check configuration.
|
|
129
|
+
* Default: For primary container with port, uses curl health check.
|
|
130
|
+
*/
|
|
131
|
+
healthCheck?: {
|
|
132
|
+
command: string[];
|
|
133
|
+
interval?: number;
|
|
134
|
+
timeout?: number;
|
|
135
|
+
retries?: number;
|
|
136
|
+
startPeriod?: number;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Cluster-level configuration.
|
|
141
|
+
* Controls the shared ALB for all services in this cluster.
|
|
142
|
+
*/
|
|
143
|
+
export interface EcsClusterClusterConfig {
|
|
144
|
+
/**
|
|
145
|
+
* Domain for HTTPS access.
|
|
146
|
+
* - Omit: ALB created with default DNS (*.elb.amazonaws.com)
|
|
147
|
+
* - Specified: Creates ACM certificate + Route53 DNS A record
|
|
148
|
+
*/
|
|
149
|
+
domain?: string;
|
|
150
|
+
/**
|
|
151
|
+
* Load balancer configuration.
|
|
152
|
+
* - false: No ALB (for workers/internal services)
|
|
153
|
+
* - "public": Internet-facing ALB (default)
|
|
154
|
+
* - "internal": VPC-only ALB
|
|
155
|
+
*/
|
|
156
|
+
loadBalancer?: false | "public" | "internal";
|
|
157
|
+
/**
|
|
158
|
+
* Enable direct EC2 access without ALB.
|
|
159
|
+
* Opens container ports on security group for direct access via EC2 public IP.
|
|
160
|
+
* Uses host network mode for predictable port mapping (container:3000 → host:3000).
|
|
161
|
+
* Only valid with EC2 capacity provider.
|
|
162
|
+
*/
|
|
163
|
+
directAccess?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Domain configuration for advanced routing policies (latency, weighted, geo).
|
|
166
|
+
* Only used when domain is specified.
|
|
167
|
+
*/
|
|
168
|
+
domainConfig?: DomainConfig;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Routing configuration for path/host-based routing on the ALB.
|
|
172
|
+
*/
|
|
173
|
+
export interface EcsRoutingConfig {
|
|
174
|
+
/** Path pattern for routing (e.g., "/api/*", "/users/*") */
|
|
175
|
+
path?: string;
|
|
176
|
+
/** Host header for routing (e.g., "api.example.com") */
|
|
177
|
+
host?: string;
|
|
178
|
+
/** Priority for this routing rule (1-50000). Lower = higher priority. */
|
|
179
|
+
priority?: number;
|
|
180
|
+
/** Health check path for this service's target group. Default: "/" */
|
|
181
|
+
healthCheckPath?: string;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Configuration for a service in an ECS cluster.
|
|
185
|
+
* Each service gets its own task definition, scaling, and target group.
|
|
186
|
+
*/
|
|
187
|
+
export interface EcsServiceProps {
|
|
188
|
+
/** Service name (unique within cluster) */
|
|
189
|
+
name: string;
|
|
190
|
+
/**
|
|
191
|
+
* Container image for this service.
|
|
192
|
+
* - Omit: Uses cluster's default ECR repository
|
|
193
|
+
* - string: ECR repository name or public image URL
|
|
194
|
+
* - Repository: CDK ECR Repository construct
|
|
195
|
+
*/
|
|
196
|
+
image?: string | Repository;
|
|
197
|
+
/**
|
|
198
|
+
* Container configurations for this service.
|
|
199
|
+
* The first container with a port is the **primary container** (receives ALB traffic).
|
|
200
|
+
*/
|
|
201
|
+
containers: EcsClusterContainerConfig[];
|
|
202
|
+
/** CPU units for this service's tasks (256-4096) */
|
|
203
|
+
cpu?: number;
|
|
204
|
+
/** Memory in MiB for this service's tasks (512-30720) */
|
|
205
|
+
memoryLimitMiB?: number;
|
|
206
|
+
/** Desired number of tasks. Default: 2 */
|
|
207
|
+
desiredCount?: number;
|
|
208
|
+
/** Scaling type (CPU or MEMORY). Omit to disable auto-scaling. */
|
|
209
|
+
scalingType?: ScalingType;
|
|
210
|
+
/** Minimum number of tasks for auto-scaling. Default: 2 */
|
|
211
|
+
minCapacity?: number;
|
|
212
|
+
/** Maximum number of tasks for auto-scaling. Default: 10 */
|
|
213
|
+
maxCapacity?: number;
|
|
214
|
+
/**
|
|
215
|
+
* Routing rules for this service on the cluster's ALB.
|
|
216
|
+
* Required when cluster has multiple services with ports.
|
|
217
|
+
* Can be a single rule or an array of rules pointing to the same target group.
|
|
218
|
+
*/
|
|
219
|
+
routing?: EcsRoutingConfig | EcsRoutingConfig[];
|
|
220
|
+
/**
|
|
221
|
+
* Additional inline policies for this service's task role.
|
|
222
|
+
* Added on top of the default ECS Exec permissions.
|
|
223
|
+
*/
|
|
224
|
+
taskRoleInlinePolicies?: {
|
|
225
|
+
[name: string]: PolicyDocument;
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Additional managed policies for this service's task role.
|
|
229
|
+
* Added on top of the default ECS Exec permissions.
|
|
230
|
+
*/
|
|
231
|
+
taskRoleManagedPolicies?: IManagedPolicy[];
|
|
232
|
+
/**
|
|
233
|
+
* Resources this service needs to connect to (e.g., databases, S3 buckets, SQS queues).
|
|
234
|
+
* Creates security group rules for IConnectable resources and IAM grants for IAM resources.
|
|
235
|
+
*
|
|
236
|
+
* Supports:
|
|
237
|
+
* - IConnectable: Security group resources (RDS, ECS, etc.)
|
|
238
|
+
* - IStorageConnector: S3 buckets (IAM grants)
|
|
239
|
+
* - IDynamoDBConnector: DynamoDB tables (IAM grants)
|
|
240
|
+
* - IQueueConnector: SQS queues (IAM grants)
|
|
241
|
+
* - ConnectionConfig: Explicit access level configuration
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* connections: [
|
|
245
|
+
* database, // Security group (RDS)
|
|
246
|
+
* { resource: cache, access: "read" }, // Read-only DynamoDB
|
|
247
|
+
* { resource: bucket, access: "write" }, // Write-only S3
|
|
248
|
+
* { resource: queue, access: "consume" } // Consume-only SQS
|
|
249
|
+
* ]
|
|
250
|
+
*/
|
|
251
|
+
connections?: ConnectionSpec[];
|
|
252
|
+
/**
|
|
253
|
+
* Capacity provider for this service. REQUIRED.
|
|
254
|
+
* Each service specifies its own capacity provider.
|
|
255
|
+
*/
|
|
256
|
+
capacityProvider: EcsCapacityProvider;
|
|
257
|
+
/**
|
|
258
|
+
* EC2 capacity configuration for this service.
|
|
259
|
+
* Only used when service capacityProvider is "EC2".
|
|
260
|
+
* Services with matching ec2Config share an ASG for efficiency.
|
|
261
|
+
*/
|
|
262
|
+
ec2Config?: Ec2CapacityConfig;
|
|
263
|
+
/**
|
|
264
|
+
* SSM Parameter Store path for secrets.
|
|
265
|
+
* If containers have secrets defined, this path is used as the base path.
|
|
266
|
+
* Format: /<app>/<cluster>/<service>
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ssmSecretsPath: "/myapp/api-cluster/users"
|
|
270
|
+
*/
|
|
271
|
+
ssmSecretsPath?: string;
|
|
272
|
+
/**
|
|
273
|
+
* Docker build target stage for multi-stage Dockerfiles.
|
|
274
|
+
* When specified, appends `-<target>` to the image tag.
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* // With dockerTarget: "api", image tag becomes: myservice-api-latest
|
|
278
|
+
* dockerTarget: "api"
|
|
279
|
+
*/
|
|
280
|
+
dockerTarget?: string;
|
|
281
|
+
/**
|
|
282
|
+
* Per-service alarm configuration.
|
|
283
|
+
* - undefined: use defaults (CPU, memory, running tasks, 5xx if ALB)
|
|
284
|
+
* - false: disable alarms for this service
|
|
285
|
+
* - object: override specific thresholds
|
|
286
|
+
*/
|
|
287
|
+
alarms?: EcsServiceAlarmThresholds | false;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Props for creating an ECS cluster with multiple services.
|
|
291
|
+
*/
|
|
292
|
+
export interface EcsClusterProps {
|
|
293
|
+
/** Cluster name */
|
|
294
|
+
clusterName: string;
|
|
295
|
+
/**
|
|
296
|
+
* Application name for SSM secrets namespace.
|
|
297
|
+
* Required when any container uses secrets without explicit ssmSecretsPath.
|
|
298
|
+
* Used to build the path: /<appName>/<clusterName>/<serviceName>
|
|
299
|
+
*/
|
|
300
|
+
appName?: string;
|
|
301
|
+
/** VPC to deploy into */
|
|
302
|
+
vpc?: IVpc;
|
|
303
|
+
/** Default ECR repository or container image */
|
|
304
|
+
ecrRepository: Repository | RepositoryImage | string;
|
|
305
|
+
/**
|
|
306
|
+
* Cluster configuration.
|
|
307
|
+
* Controls the shared ALB for all services.
|
|
308
|
+
*/
|
|
309
|
+
cluster?: EcsClusterClusterConfig;
|
|
310
|
+
/**
|
|
311
|
+
* Services in this cluster.
|
|
312
|
+
* Each service gets its own task definition, scaling, and target group.
|
|
313
|
+
* Each service MUST specify its own capacityProvider.
|
|
314
|
+
* All services share the cluster's ALB (unless disabled).
|
|
315
|
+
* Task role policies are configured per-service for least-privilege.
|
|
316
|
+
*/
|
|
317
|
+
services: EcsServiceProps[];
|
|
318
|
+
/** SNS topic for alarm notifications. Required for alarm creation. */
|
|
319
|
+
alertsTopic?: ITopic;
|
|
320
|
+
/** Application ID for alarm tagging (used by webhook to map alarms to applications). */
|
|
321
|
+
applicationId?: string;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Data tracked for each service in the cluster.
|
|
325
|
+
*/
|
|
326
|
+
export interface ServiceData {
|
|
327
|
+
service: FargateService | Ec2Service;
|
|
328
|
+
taskDefinition: FargateTaskDefinition | Ec2TaskDefinition;
|
|
329
|
+
/** Role for ECS agent (pull images, write logs, inject secrets) */
|
|
330
|
+
executionRole: Role;
|
|
331
|
+
/** Role for application code (user policies, ECS Exec) */
|
|
332
|
+
taskRole: Role;
|
|
333
|
+
containers: ContainerDefinition[];
|
|
334
|
+
primaryContainer?: ContainerDefinition;
|
|
335
|
+
targetGroup?: IApplicationTargetGroup;
|
|
336
|
+
scalingPolicy?: TargetTrackingScalingPolicy;
|
|
337
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var Protocol;
|
|
2
|
+
(function (Protocol) {
|
|
3
|
+
Protocol[Protocol["HTTP"] = 0] = "HTTP";
|
|
4
|
+
Protocol[Protocol["HTTPS"] = 1] = "HTTPS";
|
|
5
|
+
})(Protocol || (Protocol = {}));
|
|
6
|
+
export var ScalingType;
|
|
7
|
+
(function (ScalingType) {
|
|
8
|
+
ScalingType["CPU"] = "ECSServiceAverageCPUUtilization";
|
|
9
|
+
ScalingType["MEMORY"] = "ECSServiceAverageMemoryUtilization";
|
|
10
|
+
})(ScalingType || (ScalingType = {}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { EcsClusterProps } from "./ecsTypes.js";
|
|
2
|
+
/**
|
|
3
|
+
* Validates ECS cluster props before construction.
|
|
4
|
+
* Pure function — does not depend on class state.
|
|
5
|
+
*
|
|
6
|
+
* @param props - The cluster props to validate
|
|
7
|
+
* @throws Error if validation fails
|
|
8
|
+
*/
|
|
9
|
+
export declare function validateEcsClusterProps(props: EcsClusterProps): void;
|
|
10
|
+
/**
|
|
11
|
+
* Validates an SSM path component for correctness.
|
|
12
|
+
* SSM parameter paths have specific constraints that must be enforced.
|
|
13
|
+
*
|
|
14
|
+
* @param component - The path component to validate
|
|
15
|
+
* @param fieldName - Name of the field for error messages
|
|
16
|
+
* @throws Error if the component is invalid
|
|
17
|
+
*/
|
|
18
|
+
export declare function validateSsmPathComponent(component: string, fieldName: string): void;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates ECS cluster props before construction.
|
|
3
|
+
* Pure function — does not depend on class state.
|
|
4
|
+
*
|
|
5
|
+
* @param props - The cluster props to validate
|
|
6
|
+
* @throws Error if validation fails
|
|
7
|
+
*/
|
|
8
|
+
export function validateEcsClusterProps(props) {
|
|
9
|
+
const loadBalancerDisabled = props.cluster?.loadBalancer === false ||
|
|
10
|
+
props.cluster?.directAccess === true;
|
|
11
|
+
// Validate services array
|
|
12
|
+
if (!props.services || props.services.length === 0) {
|
|
13
|
+
throw new Error("At least one service must be specified.");
|
|
14
|
+
}
|
|
15
|
+
// Check for duplicate service names
|
|
16
|
+
const serviceNames = props.services.map((s) => s.name);
|
|
17
|
+
const duplicateServices = serviceNames.filter((name, index) => serviceNames.indexOf(name) !== index);
|
|
18
|
+
if (duplicateServices.length > 0) {
|
|
19
|
+
throw new Error(`Duplicate service names: ${[...new Set(duplicateServices)].join(", ")}`);
|
|
20
|
+
}
|
|
21
|
+
// Validate routing when multiple services have ports
|
|
22
|
+
const servicesWithPorts = props.services.filter((s) => s.containers.some((c) => c.port !== undefined));
|
|
23
|
+
if (servicesWithPorts.length > 1 && !loadBalancerDisabled) {
|
|
24
|
+
const missingRouting = servicesWithPorts.filter((s) => {
|
|
25
|
+
const rules = Array.isArray(s.routing)
|
|
26
|
+
? s.routing
|
|
27
|
+
: s.routing
|
|
28
|
+
? [s.routing]
|
|
29
|
+
: [];
|
|
30
|
+
return !rules.some((r) => r.path || r.host);
|
|
31
|
+
});
|
|
32
|
+
if (missingRouting.length > 0) {
|
|
33
|
+
throw new Error(`Services with ports require routing config when cluster has multiple services: ` +
|
|
34
|
+
`${missingRouting.map((s) => s.name).join(", ")}. ` +
|
|
35
|
+
"Add routing: { path: '/...' } to each service.");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Validate each service's containers
|
|
39
|
+
for (const service of props.services) {
|
|
40
|
+
if (!service.containers || service.containers.length === 0) {
|
|
41
|
+
throw new Error(`Service '${service.name}': At least one container must be specified.`);
|
|
42
|
+
}
|
|
43
|
+
// Check for duplicate container names within service
|
|
44
|
+
const containerNames = service.containers.map((c) => c.name);
|
|
45
|
+
const duplicateContainers = containerNames.filter((name, index) => containerNames.indexOf(name) !== index);
|
|
46
|
+
if (duplicateContainers.length > 0) {
|
|
47
|
+
throw new Error(`Service '${service.name}': Duplicate container names: ` +
|
|
48
|
+
`${[...new Set(duplicateContainers)].join(", ")}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Validates an SSM path component for correctness.
|
|
54
|
+
* SSM parameter paths have specific constraints that must be enforced.
|
|
55
|
+
*
|
|
56
|
+
* @param component - The path component to validate
|
|
57
|
+
* @param fieldName - Name of the field for error messages
|
|
58
|
+
* @throws Error if the component is invalid
|
|
59
|
+
*/
|
|
60
|
+
export function validateSsmPathComponent(component, fieldName) {
|
|
61
|
+
if (!component || component.trim() === "") {
|
|
62
|
+
throw new Error(`${fieldName} cannot be empty for SSM path derivation`);
|
|
63
|
+
}
|
|
64
|
+
if (component.includes("/")) {
|
|
65
|
+
throw new Error(`${fieldName} cannot contain forward slashes (/). Invalid value: "${component}".`);
|
|
66
|
+
}
|
|
67
|
+
// SSM parameter name hierarchy labels have a max length of 2048, but we use a more
|
|
68
|
+
// reasonable limit since each component is just one part of the path
|
|
69
|
+
if (component.length > 128) {
|
|
70
|
+
throw new Error(`${fieldName} exceeds maximum length (128 characters).`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./ec2";
|
|
2
|
-
export * from "./ecs";
|
|
3
|
-
export * from "./lambda";
|
|
1
|
+
export * from "./ec2.js";
|
|
2
|
+
export * from "./ecs.js";
|
|
3
|
+
export * from "./lambda.js";
|
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./ec2"), exports);
|
|
18
|
-
__exportStar(require("./ecs"), exports);
|
|
19
|
-
__exportStar(require("./lambda"), exports);
|
|
20
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWIvcmVzb3VyY2VzL2F3cy9jb21wdXRlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSx3Q0FBc0I7QUFDdEIsd0NBQXNCO0FBQ3RCLDJDQUF5QiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gXCIuL2VjMlwiO1xuZXhwb3J0ICogZnJvbSBcIi4vZWNzXCI7XG5leHBvcnQgKiBmcm9tIFwiLi9sYW1iZGFcIjtcbiJdfQ==
|
|
1
|
+
export * from "./ec2.js";
|
|
2
|
+
export * from "./ecs.js";
|
|
3
|
+
export * from "./lambda.js";
|
|
@@ -6,8 +6,10 @@ import { Rule, type EventPattern } from "aws-cdk-lib/aws-events";
|
|
|
6
6
|
import { type IQueue } from "aws-cdk-lib/aws-sqs";
|
|
7
7
|
import { type ITable } from "aws-cdk-lib/aws-dynamodb";
|
|
8
8
|
import { type Construct } from "constructs";
|
|
9
|
-
import { type KeyValue } from "../../../types";
|
|
10
|
-
import { type SecretImport } from "../secrets";
|
|
9
|
+
import { type KeyValue } from "../../../types.js";
|
|
10
|
+
import { type SecretImport } from "../secrets/index.js";
|
|
11
|
+
import type { ITopic } from "aws-cdk-lib/aws-sns";
|
|
12
|
+
import { type LambdaAlarmThresholds } from "../monitoring/index.js";
|
|
11
13
|
export interface LambdaFunctionProps {
|
|
12
14
|
code: Code;
|
|
13
15
|
handler: string;
|
|
@@ -35,6 +37,12 @@ export interface LambdaFunctionProps {
|
|
|
35
37
|
secretsImport?: Record<string, SecretImport>;
|
|
36
38
|
appName?: string;
|
|
37
39
|
functionName?: string;
|
|
40
|
+
/** SNS topic for alarm notifications. Required for alarm creation. */
|
|
41
|
+
alertsTopic?: ITopic;
|
|
42
|
+
/** Alarm thresholds. false to disable, undefined for defaults, object to override. */
|
|
43
|
+
alarms?: LambdaAlarmThresholds | false;
|
|
44
|
+
/** Application ID for alarm tagging. */
|
|
45
|
+
applicationId?: string;
|
|
38
46
|
}
|
|
39
47
|
export interface SingletonFunctionProps extends LambdaFunctionProps {
|
|
40
48
|
uuid?: string;
|