@almamedia-open-source/cdk-project-target v0.0.10
Opinionated set of AWS Account & Application Environment configuration combinations and utilities to manage them for CDK Projects.
Important
🚧 This tool is work-in-progress and experimental!
All @almamedia-open-source/cdk- prefixed constructs/utilities are based on existing CDK constructs/utilities we've developed & used (in production) internally at Alma Media since 2019.
Breaking changes may occur at any given time without prior warning before first v1 major is released, as we rewrite them for CDK v2 and use this opportunity to also redesign & refactor.
Feedback is most welcome, but do note that we intend to implement these new constructs/utilities and their APIs in such manner that our existing CDK v1 production workloads can easily migrate into these new @almamedia-open-source/cdk- constructs/utilities.
Overview
TODO
Installation
Ensure you meet following requirements:
- NodeJS
v14.17.6or newer - AWS Cloud Development Kit
v2.0.0or newer
- NodeJS
Install peer dependency
@almamedia-open-source/cdk-project-context:npm i -D @almamedia-open-source/cdk-project-contextInstall this tool:
npm i -D @almamedia-open-source/cdk-project-target
Usage
Initialize your CDK App with
Projectconstruct as documented in@almamedia-open-source/cdk-project-contextbut also use one of the following methods ofAccountsclass:Accounts.oneAccounts.twoAccounts.three
// bin/app.ts import { Project } from '@almamedia-open-source/cdk-project-context'; import { Accounts } from '@almamedia-open-source/cdk-project-target'; // new Project instead of new App const project = new Project({ name: 'my-cool-project', author: { organization: 'Acme Corp', name: 'Mad Scientists', email: 'mad.scientists@acme.example.com', }, defaultRegion: 'eu-west-1', // defaults to one of: $CDK_DEFAULT_REGION, $AWS_REGION or us-east-1 accounts: Accounts.two({ dev: { id: '111111111111', config: { baseDomain: 'example.net', }, }, prod: { id: '222222222222', config: { baseDomain: 'example.com', }, }, }), })TODO
Migration
This section only applies if you're an Alma Media employee who is migrating from our internal CDK v1 compatible constructs.
Account Context
Match ProjectContext (PC) casing:
-Ac
+ACMethods follow the format used in ProjectContext (where there is overlap):
Account ID
-Ac.getId
+AC.getAccountIdAccount Description
-Ac.getDescriptionAccount Base Domain
-Ac.getDomainAccount Type
-Ac.getType
+AC.getAccountTypeIs Prod account type
-Ac.isProd
+AC.isProdIs Dev account type
-Ac.isDev
+AC.isDevIs PreProd account type
-Ac.isPreprod
+AC.isPreprodnot used
Is Shared account type
-Ac.isShared
+AC.isSharedIs Mock account type
TODOGet Configuration
-Ac.getConfig(ths, 'path', defaultValue)
+AC.getAccountConfig(this, 'path', defaultValue) # TODO: Implement the lodash path in ProjectContextEnvironment Context
Environment Name
-Ec.getName
+EC.getNameEnvironment URL/DNS compatible name
-Ec.getSubdomain # foo-bar.feature
+EC.getUrlName # feature-foo-barEnvironment Label (New)
+Ec.getLabelEnvironment Type (Category)
-Ec.getType
+EC.getCategoryReturn values:
mock
development
-preview
+feature
verification
stableEnvironment Description
-Ec.getDescriptionEnvironment Domain
Implemented in separate construct.
-Ec.getDomainPreview (Feature) Environment Info
-Ec.getPreviewInfo
+EC.getFeatureInfoIs Mock Environment
-Ec.isMock
+EC.isMockIs Development Environment
-Ec.isDevelopment
+EC.isDevelopmentIs Preview (Feature) Environment
-Ec.isPreview
+EC.isFeatureIs Pre Environment
-Ec.isPre
+EC.isVerificationIs Stable Environment
-Ec.isStable
+EC.isStableStack Context
Removed completely: Use @almamedia-open-source/cdk-project-stack instead.
