I have installed terraform on windows. Below is the directory structure of how i have configured my config files.
D:\TERRAFORM_PRACTICALS\TERRAFORM-BEGINS
│ .terraform.lock.hcl
│ main.tf
│ main.tfplan
│ terraform.tfstate
│ terraform.tfstate.backup
│
├───.terraform
│ ├───modules
│ │ │ modules.json
│ │ │
│ │ └───network.test
│ │ resource_group.tf
│ │
│ └───providers
│ └───registry.terraform.io
│ └───hashicorp
│ └───azurerm
│ └───4.26.0
│ └───windows_386
│ LICENSE.txt
│ terraform-provider-azurerm_v4.26.0_x5.exe
│
├───mod
│ resource_group.tf
│
└───network
app-nic.tf
my main.tf file is mentioned below
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "4.26.0"
}
}
}
provider "azurerm" {
features {}
subscription_id = "##########"
tenant_id = "##########"
client_id ="##########"
client_secret = "##########"
}
module "network"{
source="./network"
}
and under network there is one more file which i mentioned below
module "test" {
source="D:/terraform_practicals/terraform-begins/mod"
}
resource "azurerm_virtual_network" "app-network" {...
}
My question is is there any better approach that i am writing this long path in source module of test or how can i define the modules and call them . Either i should create one directory called module and there i am defining other modules or this approach which i am following.