The big thing for TF is that you can version and iterate on your
infrastructure for different environments, and only have the data be
different for each one, using a thought out structure and some
symlinks goes a long way of not duplicating resources declaration that
are identical.
If you haven't read Charity Majors blog about terraform, you should (
https://charity.wtf/2016/04/14/scrapbag-of-useful-terraform-tips/ )
Personally, right now I do something like this:
root
- providers
-- aws
--- eu_west_1_staging
----
main.tf (symlink to ../
main.tf)
----
staging_specific.tf
---- terraform.tfvars
--- eu_west_1_production
----
main.tf (symlink to ../
main.tf)
---- terraform.tfvars
--- global/ (IAM, DNS etc)
---
main.tf
- modules
-- aws
--- service specific modules (my_cool_app/{main,output,variables}.tf
or whatever)
All low level modules (think VPC, subnets, RDS, elasticache,
autoscaling groups &c) live in their own git repo.
And in the main repo you have your service specific modules (that
probably uses the low level modules under the hood)
This setup also expects that each region+environment has it's own
state file and doesn't share.
There is still a lot going on in how to structure and develop with
terraform, some use remote state extensively, I have not yet gone that
route myself so I can't comment on how well it works.
--
Lowe Schmidt | +46 723 867 157
>
https://groups.google.com/d/msgid/terraform-tool/9bacec91-2b9a-482c-a072-9b029915ff12%40googlegroups.com.