AWS Emulator Catches Terraform Apply Failures That Plan Misses
Testing Terraform with AWS Emulator

Terraform plan can pass while apply fails on real AWS API constraints, like a DynamoDB table name that's too short. AWS's new Emulator runs a self-contained local or CI endpoint that mimics AWS APIs, so you can apply against it before touching production. I tested it locally and in a GitHub Actions pipeline; it caught a deliberately broken resource in about 1m25s. It still lacks IAM policy checks and returns 501 for some services.
The exact issue that arises only against actual API calls and not during a plan job. For scenarios exactly like this, the emulator is priceless.
- itintheory
> These mock calls can't know for a fact that you already have a resource in AWS called "my-bucket-asdasdasd"
Doesn't seem like the AWS Emulator would know that either, unless it's connecting to real AWS... Also, bucket names are global, so it doesn't matter what you have, it's what anyone has.
- 0xbadcafebee
The problem with testing with Terraform or any other tool is that the emulator won't accurately reflect real-world behavior. The real world services have a bunch of logic and code of them which isn't all replicated in the emulator. The only thing the emulator does is replicate the API. It's a bit like trying to build a model of a house by building the model to look like the outside of the house. Gives you an idea what it looks like, but working within that model is not going to be the same as working within the actual house.
- whinvik
Nice. Now for GCP to also release such a tool