Member-only story

Reusable infrastructure with Terraform Modules

Nidhi
2 min readNov 17, 2020

--

Check my YouTube video for this article

For more articles, please follow my website

https://devops4solutions.com/

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:

  1. Install Terraform and configure AWS secret…

--

--

Nidhi
Nidhi

Written by Nidhi

Devops Automation Enginneer

No responses yet