A security finding names a deployed resource: sg-0a91f3c2, a bucket, a policy ARN. The fix doesn't belong on that resource. Change it in the console and the next deploy puts it back. The fix belongs in the code that created it, and in most companies that code is written with more than one tool.
From a resource to a line of code
Each tool leaves a different trail from the deployed resource back to its source:
- Terraform: state maps the resource id to an address, such as
module.bastion.aws_security_group.this, and the address to a block in a.tffile. - CloudFormation and SAM: the stack maps the physical id to a logical id, and the logical id to a resource in the template.
- CDK: the synthesized template carries
aws:cdk:pathmetadata, which leads to the construct in your TypeScript, Python, Go, C# or Java program. - Pulumi: a
pulumi stack exportmaps the id to a resource name, which leads to the call in your program, in any of six languages.
PosturaNet follows that trail and edits the line it finds, in the style the file already uses: a new ingress entry looks like its neighbors, a new setting goes where the others are.
When it refuses
Program code can build a value at runtime: a CIDR read from config, a policy assembled in a loop. PosturaNet can't map that back to one line, so it stops with UNKNOWN and says why, instead of patching the synthesized output and hoping. The same goes for a template parameter it can't resolve or a construct used in more than one place.
Validation without write access
Each tool's own preview runs read-only. Terraform gets terraform plan -lock=false. CDK gets cdk synth with no AWS credentials, then the CloudFormation checks. CloudFormation can use an opt-in change-set preview with a separate role: the change set is created, read and deleted, never executed. pulumi preview needs write-capable credentials, so PosturaNet doesn't run it. It checks the program statically, and the PR says the preview wasn't run.
One contract, whichever tool
Behavior contracts are keyed on the resource, not the tool. A team moving from CloudFormation to CDK keeps its contracts, and the same contract check gates changes in both.
Setup for each tool is in the docs: Terraform, CloudFormation, CDK and Pulumi.