Terraform Multiple State Files Best Practice Examples

Viewed 16682

I am trying to build out our AWS environments using Terraform but am hitting some issues scaling. I have a repository of just modules that I want to use repeatedly when building my environments and a second repository just to handle the actual implementations of those modules.

I am aware of HashiCorp's Github page that has an example but there, each environment is one state file. I want to split environments out but then have multiple state files within each environment. When the state files get big, applying small updates takes way too long.

Every example I've seen where multiple state files are used, the Terraform files are extremely un-DRY and not ideal.

I would prefer to be able to have different variable values between environments but have the same configuration.

Has anyone ever done anything like this? Am I missing something? I'm a bit frustrated because every Terraform example is never at scale and it makes it hard for n00b such as myself to start down the right path. Any help or suggestions is very much appreciated!

1 Answers
Related