Member-only story
For more articles, please follow my website
As development, staging and production environment are isolated from each other, so does the terraform code required to. In order to built a re-usable terraform code for both staging and production environment, without conducting copy and paste, one must follow the modules strategy. In this blog we will learn how to create Reusable infrastructure with Terraform Modules
Terraform modules:
Think of them just like functions in a programming language, which we define once and then call them by passing parameters from anywhere in the code. Just like functions, put the infrastructure code inside a Terraform module and then reuse it in multiple places throughout the code.
Thus, both our staging and production environment (which are almost identical) can use the same modules without the requirement to copy and paste.
Let’s build a very basic and simple AWS network, comprising of a VPC and subnet
Prerequisite:
- Install Terraform and configure AWS secret…