fun-stack / terraform-aws-fun

Terraform module to provision AWS infrastructure for fun-stack
MIT License
5 stars 1 forks source link

Better isolation for environments #13

Closed fdietze closed 2 years ago

fdietze commented 2 years ago

Currently, different environments live in the same AWS account, where the isolation is done by using different name prefixes on e.g. lambdas and dynamo tables. Is there a better way to isolate environments?

Different AWS accounts would be an option, but AFAIK they cannot be created programmatically. Are there other isolation mechanisms?

cornerman commented 2 years ago

I do not see anything else than prefixing or multiple accounts. I think, account-level isolation is the best with regards to security and naming without prefix. But, as you said, setting it up is afaik not fully automatable.

Though, thinking about multi-environment, there might be a lot of environments (maybe per developer) and then having so many accounts for that seems a bit overboard. So, I am also not sure whether the prefix should really go away then.

fdietze commented 2 years ago

Maybe both then:

cornerman commented 2 years ago

Is it really worth it to have no prefix in production? It complicates the code, because you have change the prefix based on the environment. Also, it requires that you use a different account in production and staging.

In the end, you can currently chose whenever you deploy, which account you use (by your AWS_PROFILE).

fdietze commented 2 years ago

Interesting. So the staging/production switch can be handled by AWS_PROFILE.

Prefixing doesn't have to be disabled. I just thought to have a single prefix (prod-) in the production account.