Gathering detailed insights and metrics for @wheatstalk/cdk-intrinsic-validator
Gathering detailed insights and metrics for @wheatstalk/cdk-intrinsic-validator
Gathering detailed insights and metrics for @wheatstalk/cdk-intrinsic-validator
Gathering detailed insights and metrics for @wheatstalk/cdk-intrinsic-validator
Make deployments safer by adding intrinsic validation to your stacks.
npm install @wheatstalk/cdk-intrinsic-validator
Typescript
Module System
Node Version
NPM Version
TypeScript (93.91%)
JavaScript (6.09%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
57 Stars
819 Commits
2 Forks
3 Watchers
2 Branches
4 Contributors
Updated on Mar 08, 2025
Latest Version
0.3.41
Package Id
@wheatstalk/cdk-intrinsic-validator@0.3.41
Unpacked Size
2.35 MB
Size
428.13 kB
File Count
27
NPM Version
10.7.0
Node Version
18.20.4
Published on
Sep 02, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
29
This CDK construct allows you to add intrinsic validation to your CDK stacks. Adding intrinsic validation adds checks that occur during deployment that, if they fail, will automatically roll back the stack.
Example error
You can view errors directly in your CloudWatch event log. To see these
errors, ensure that you run the CDK CLI with --progress events
.
You can add the following intrinsic validations:
1// Create an ECS cluster to run some Fargate tasks in.
2const cluster = new ecs.Cluster(scope, 'Cluster');
3
4// Instantiate a convenience tool for creating Fargate validations with common
5// options (i.e., a specific ecs cluster.)
6const fargateValidations = new FargateValidationFactory(scope, 'FargateValidationFactory', {
7 cluster,
8});
9
10// Let's do some testing with the curl container image.
11const curlImage = ecs.ContainerImage.fromRegistry('curlimages/curl:7.78.0');
12
13// Validate the stack on every deploy and fail the deployment if any of
14// the given validations fail so that CloudFormation can auto-rollback.
15new IntrinsicValidator(scope, 'IntrinsicValidator', {
16 validations: [
17 // Test a public endpoint to see if it responds to HTTP:
18 fargateValidations.runContainer({
19 // Add an optional label to help identity the validation.
20 label: 'cURL the Front Page',
21 image: curlImage,
22 command: ['https://www.amazon.ca/'],
23 }),
24
25 // Most validations are available through the abstract factory.
26 Validation.alwaysSucceeds(),
27
28 // The following validations will fail and roll back the stack:
29 // fargateValidations.runContainer({
30 // image: curlImage,
31 // command: ['https://fake.fake.fake/'],
32 // }),
33 // Validation.alwaysFails(),
34 ],
35});
1new IntrinsicValidator(scope, 'IntrinsicValidator', {
2 validations: [
3 // Use this generic interface to launch a Fargate task on the given cluster
4 // from the given task definition. If the task run fails, the stack
5 // deployment will cancel and roll back.
6 Validation.fargateTaskSucceeds({
7 cluster,
8 taskDefinition,
9 // ... other options:
10 // assignPublicIp: ...,
11 // containerOverrides: ...,
12 // securityGroups: ...,
13 // subnets: ...,
14 }),
15 ],
16});
1new IntrinsicValidator(scope, 'IntrinsicValidator', {
2 validations: [
3 // Monitor the given alarm for five minutes before allowing the deployment
4 // to complete. If the alarm starts sounding while intrinsic validation is
5 // monitoring it, the stack will roll back automatically.
6 Validation.monitorAlarm({
7 alarm,
8 duration: cdk.Duration.minutes(1),
9 }),
10 ],
11});
1new IntrinsicValidator(scope, 'IntrinsicValidator', {
2 validations: [
3 // Invoke the given Lambda function. If the function fails, the deployment
4 // will be cancelled and rolled back.
5 Validation.lambdaInvokeSucceeds({
6 lambdaFunction,
7 }),
8 ],
9});
1new IntrinsicValidator(scope, 'IntrinsicValidator', {
2 validations: [
3 // Execute the given step function and if it fails, cancel and roll back
4 // the deployment.
5 Validation.stateMachineExecutionSucceeds({
6 stateMachine,
7 // Input is optional
8 input: TaskInput.fromObject({
9 anything: 'you need',
10 }),
11 }),
12 ],
13});
With the httpCheck
validation, you can check a URL on every stack
deployment without the overhead of having a VPC or waiting for containers
to spin up.
1new IntrinsicValidator(scope, 'IntrinsicValidator', {
2 validations: [
3 Validation.httpCheck({
4 // Replace this URL with a public endpoint of your own
5 url: 'https://httpstat.us/200',
6 // (optional) Expect an http 200 status
7 expectedStatus: '200',
8 // (optional) Ignore http 4xx or 502 statuses and retry the check up to the timeout
9 retryStatus: '400-499,502',
10 // (optional) Try for up to 14 minutes
11 timeout: Duration.minutes(14),
12 // (optional) Check the page content for a node-compatible regex
13 checkPattern: '\\d+\\s+OK',
14 // (optional) Provide regex flags
15 checkPatternFlags: 'i',
16 }),
17 ],
18});
IntrinsicValidator
to your stack for the first time, try
adding it without validations. This way, if the intrinsic validator catches
a validation error, you can keep the State Machine that contains the error.If you are using snapshot tests on your stack then you may run into issues because the stack will constantly fail as the Logical ID of the intrinsic validator will always be different. You can you disable this in your tests using a context value:
1import { DisableRandomnessContextKey } from '@wheatstalk/cdk-intrinsic-validator'; 2 3test('Snapshot test', ()=> { 4 const app = new App({ 5 context: { 6 [DisableRandomnessContextKey]: true, 7 }, 8 }); 9}); 10
No vulnerabilities found.
Reason
all changesets reviewed
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
SAST tool is run on all commits
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
security policy file detected
Details
Reason
7 existing vulnerabilities detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More