Blocks in terraform
To use provider with specific version
- To find provider browse them in terraform registry Refer Here
- Every provider will have documentation
- AWS Provider Refer Here
- Azure Provider Refer Here
- Every provider will have many versions to use a specific version of the provider an additional syntax is required
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.0"
}
}
}
- Lets try to understand
~>
Using count to create multiple subnets in AWS for ntier-architecture
- For the template developed in the class Refer Here

- Terraform has built in functions Refer Here
- We have used the length function to find the length of subnets from variables this helped in setting the count based on list size. Refer Here
- Refer Here for the changes

- We have used cidrsubnet function to dynamically create subnet cidr’s Refer Here for the change set. Refer Here for the function documentation.
