DEV Community

Rahul Wagh
Rahul Wagh

Posted on • Originally published at jhooq.com

How to create terraform modules? - Part 9

Terraform is an IaC(infrastructure as Code) framework for managing and provisioning the infrastructure but have you ever thought of creating only a single terraform configuration file for managing the complete cloud infrastructure.

Well, it sounds insane because if you only have a single file for managing the complete infrastructure then it will grow in complexity as well the line of configuration code will be manifold. That is why terraform introduced a concept of the module that will help you to organize your terraform configuration so that you can re-use the configuration and keep your terraform code more clean and more modular.

In this Lab session, we will create two modules module-1 and module-2. Inside each module, we will install the apache httpd server with each module is having its home page.

Steps for Creating the module -

  1. Create your first module
  2. Module structure
  3. Calling the module
  4. Module best practices
  5. Benefits of Modules

Terraform Module instruction guide? - https://jhooq.com/terraform-module/

Discussion (0)