Terraform Oct Day 3 Notes
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
Teraraform Modules
How to Use Module Dev by others?
How to write your own Module?
=====================================
What is module?
-----------------------------
Is a Dir which contains
- tf
- tfvars
-----------------------------
ROOT MODULE
Child Module
Dir
main.tf
<module1>
<module2>
Module1
main.tf
terraform.tfvars
Module2
main.tf
terraform.tfvars
Module3
main.tf
terraform.tfvars
EXAMPLE
https://github.com/Azure/terraform-azurerm-vnet/tree/main/examples
https://registry.terraform.io/modules/Azure/vnet/azurerm/latest?tab=inputs
https://www.devopsschool.com/blog/terraform-modules-explained/
Terraform Workspace
Terraform Backends
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.75.0"
}
aws = {
source = "hashicorp/aws"
version = "5.20.0"
}
github = {
source = "integrations/github"
version = "5.39.0"
}
}
backend "azurerm" {
resource_group_name = "eksuw01-rg"
storage_account_name = "eksuw01sa"
container_name = "rajesh"
key = "prod.terraform.tfstate"
subscription_id = "b3dbe884-c3dc"
client_id = "6046fe74-dfd2-4"
client_secret = "3XJ8Q~uvlwVL"
tenant_id = "f34c8fc4-16b"
}
}
provider "azurerm" {
features {}
subscription_id = "b3dbe884c"
client_id = "6046fe74-d"
client_secret = "3XJ8Q~uvlwV"
tenant_id = "f34c8fc4-1"
}