The problem
Every time terraform plan showed drift, I'd see something like this:
~ aws_security_group.web will be updated in-place
~ ingress = [
{
from_port = 22
protocol = "tcp"
to_port = 22 }, ]
Terraform tells you what changed. It tells you nothing about who
changed it, when, or how.
So I'd open the AWS Console, navigate to CloudTrail, set the time range,
filter by resource, scroll through dozens of unrelated events, and
eventually find the culprit — 20 minutes later.
Every. Single. Time.
What I built
tf-why — a CLI that pipes terraform show -json output directly into
AWS CloudTrail and gives you attribution in seconds.
terraform show -json plan.tfplan | tf-why
Enter fullscreen mode
Exit fullscreen mode
Output:
aws_security_group.web (ingress rules changed)
├── Changed by: [email protected]
├── When: 2 days ago (2026-05-02 14:32 UTC)
├── Via: AWS Console
└── Event: AuthorizeSecurityGroupIngress
aws_s3_bucket.assets (versioning changed)
├── Changed by: ci-deploy-role
├──…