Rendered at 05:48:05 GMT+0000 (Coordinated Universal Time) with Cloudflare Workers.
danw1979 22 hours ago [-]
PSA: don’t ever pass your AWS credentials as TF_VAR_s, they’ll end up in the state file, which is a bad thing.
from the article, in a github actions workflow:
‘TF_VAR_secret_key: … ‘
and yeah this was just for the “emulator” provider config but you know someone will come along and copy your example for a real workflow and provider config.
(Yes, I know about state encryption, thank you.)
jen20 20 hours ago [-]
[dead]
itintheory 1 days ago [-]
> 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.
You're right, but I used this very basic example just to highlight one of the possible problems that planjob may miss.
lmz 20 hours ago [-]
Ok, but how does this replicate the current/before state from the live environment? Wouldn't this always do a from-scratch creation?
hatedabamboo 19 hours ago [-]
Yes, every run inside pipeline starts from scratch, Emulator state is in-memory only.
0xbadcafebee 1 days ago [-]
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.
ctkhn 1 days ago [-]
Most teams I've been on have used a pre-production environment for a combination of performance testing and making sure infra worked as expected. To a smaller degree with less instances etc, we use our dev and test environments to make sure infra works the same as it should in higher envs.
ozarkerD 1 days ago [-]
Agreed. We also have a fair amount of TF testing involving IAM to make sure we get permissions right which the emulator doesn’t emulate at all unfortunately.
QGQBGdeZREunxLe 1 days ago [-]
The problem with full e2e tests for Terraform is that they are 1. Extremely slow 2. Can be expensive.
LocalStack and hopefully the new AWS Emulator can give you a fairly high degree of confidence.
jamesfinlayson 1 days ago [-]
Yep. Twice this year I've had working CloudFormation break because AWS decided to change validation without telling us.
OJFord 1 days ago [-]
Let's not do unit tests or local dev environments either then.
from the article, in a github actions workflow:
‘TF_VAR_secret_key: … ‘
and yeah this was just for the “emulator” provider config but you know someone will come along and copy your example for a real workflow and provider config.
(Yes, I know about state encryption, thank you.)
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.
LocalStack and hopefully the new AWS Emulator can give you a fairly high degree of confidence.