Terraform modules
- Module is a reusable Terraform template
- Every terraform template is a root module which calls the child modules
- child modules are resuable terraform configuration
- Child Modules can be present
- in local system
- in git repo
- in Terraform cloud
- in jfrog
Activity – 1: Create a ntier architecture in aws
- Lets convert the work done earlier into modules
- to create ntier architecture, we need
- vpc
- security groups
- ec2/autoscaling groups
- load balancers
- We have started creating modules inside the root module
ntier
modules
vpc
main.tf
variables.tf
outputs.tf
providers.tf
main.tf
- Refer Here for changes
- Using modules like this is done on servers where all the terraform modules are present on a network file share.
- Lets have our modules hosted seperately on Git
- Refer Here for the module
- for referring module from git Refer Here for git and Refer Here for subdirectories
- Refer Here for the security group module
- Refer Here for using the security group module from git
Activity – 2: Create a ntier architecture in azure
- Lets convert the work done earlier into modules
- to create ntier architecture, we need
- virtual network
- network security groups
- vm/vmss
- load balancers
Terrascan
- This scans terraform for security vulnerabilities and generates the report
- Refer Here
Terraform cloud
- Refer Here for creating account
- Refer Here for terrform cloud usage
