Skip to content

Correctness Rules

Correctness rules catch structural errors that would cause evaluation or deployment failures.


Use typed property access instead of string-based GetAtt() or Ref() calls. String references bypass type checking and break if a resource is renamed.

Severity: warning

// ❌ Triggers COR003
export const fn = new _.Function({
role: GetAtt("functionRole", "Arn"),
bucket: Ref("dataBucket"),
});
// ✅ Fixed — use typed AttrRef properties
import { functionRole } from "./role";
import { dataBucket } from "./storage";
export const fn = new _.Function({
role: functionRole.arn,
bucket: dataBucket.ref,
});

Exported declarables that are never referenced by another resource in the same file may be dead infrastructure code.

Severity: warning

// ❌ Triggers COR004
export const logsBucket = new _.Bucket({
bucketName: "logs",
});
export const dataBucket = new _.Bucket({
bucketName: "data",
});
// logsBucket is never used — flagged
// ✅ Fixed — reference it or remove it
export const logsBucket = new _.Bucket({
bucketName: "logs",
});
export const dataBucket = new _.Bucket({
bucketName: "data",
loggingConfiguration: { destinationBucketName: logsBucket.ref },
});

All declarable instances must be exported so chant can discover them during synthesis. Non-exported resources are invisible to the build pipeline.

Severity: error

// ❌ Triggers COR008
const bucket = new _.Bucket({
bucketName: "my-data",
});
// ✅ Fixed
export const bucket = new _.Bucket({
bucketName: "my-data",
});