Cloud Native — Terraform Part: 3
In the last article I went over how to setup AWS, create a IAM user, cloud9 and setting a Budget. If you missed that article check it out here:
https://medium.com/cloud-native-devops-devsecops/cloud-native-aws-terraform-part-2-49067d8fb5d4
In this article I will show you how to setup a Docker provider, structure your .tf files, and workflow commands.
File Structure:
Before I go into configuration let’s step back and think about a few things. If you have been following this series, I have talked about Heroku, AWS, Github and docker all of them are considered providers. Currently I have AWS resources mixed with Github and Heroku resources, this is causing the code base to become hard to read and a bit overwhelming. It would be nice if I had a file for each provider and their resources listed by their environment.
This is better and can get even better with a little work. When I write code my number one goal is readability and always strive towards increasing readability by refactoring code whenever I can. By re-structuring the files and naming them with the provider-environment. It is very easy for another developer to understand the basic structure and make changes if necessary.
When I was working on the file re-structure I was using the Terraform workflow…