I’m a full stack developer and I will be informing you on how to raise infrastructure configuration to the next level using “Terraform”. I want to tell you a few small tricks and architecture patterns that we learned in our journey to creating our infrastructure with terraform that might be helpful to you if you are about to embark on the journey on your own.
We are the largest comparison website in Austria. We compare everything that you would need a contract for such as insurances, energy, banking and everything you could ever need. We do about 15000 comparisons per day for our users on our website,we evolved from a startup to scale up to an established company. Within this process our infrastructure needs changed. We formalized our infrastructure setup, and we are hiring. Keeping our servers up to date with this amount of strong servers we always had to make sure that our operating systems are up to date and that our installed packages are up to date. So what was our path to a solution? First of all we harmonize the providers so we switch mainly gcp and we use managed container environments. we use infrastructure as code with “terraform”.
Terraform in its core is infrastructure as a code tool. This means that our actual infrastructure is defined in text files which we can check in a version control system. This means we always have a representation of our current infrastructure which can be checked out, changed and then applied. The whole infrastructure is set up so a new cloud function is deployed, another big plus to Terraform is that it’s open source so it’s free to use in its basic form and it supports all major cloud providers so you can in a good way implement multi-cloud infrastructure. A Cloud for instance has to have 500 gigs, bits, megabytes of memory and it has to have three cores and it may scale up to 10 parallel instances. We make use of the cloudron application for a part of our website, it can be configured using min scale, max scale and memory. One instance is always running maximum instances of 10 so at most if we have a lot of traffic we will scale up to at max 10 ports, we use 2 000 megabytes of ram and no cpu throttling.
The Config File Location
This Config file location this is our custom configuration, this is what we customly added to define within Terraform what config file will be used at runtime, so this port in this instance means production environment which means this website next module will be started using the production configuration,we can have different configurations at the same time in the production code and Terraform inserts environment variable which is read on startup and decided which config is to be used. You need some “API KEYS '' or whatever you need to use secrets in your configurations. This basically enables us to have all our secrets stored in the secret manager using minimal need to know principles for respective services as well as having different secrets. I would say that all parallel working in terraform has its problems, because you always have the complete configuration if you want to. You always need to push your changes because Terraform is not something you always permanently work on.