Creating a Tf module and publishing it to the Terraform registry

Through this article you will learn to create a terraform module for a static website and publish it to the terraform registry. Before going ahead, you need to have some basic understanding of terraform.

Step-1:

Create an account on terraform registry.

Step-2:

Create a directory in your local machine following a proper naming convention like “terraform-azurerm-<name of the module>”. In this case I will use “terraform-azurerm-static-website”. Create the following files in your directory:

  1. main.tf
  2. variables.tf
  3. output.tf
  4. versions.tf
  5. readme.md

Your directory must look like this:

Website