You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are going to use a VPC Module from Terraform Public Registry
Understand about Authenticity of a module hosted on Public Terraform Registry with HashiCorp Verified Tag
Review the download rate for that module
Review the latest versions and release history of that module
Review our feature needs when using that module and ensure if our need is satisfied use the module else use the standard terraform resource definition appraoch.
Review module inputs, outputs and dependencies too.
Step-02-02: Create a VPC Module Terraform Configuration
For modules locking to the exact version is recommended to ensure there will not be any major breakages in production
When depending on third-party modules, require specific versions to ensure that updates only happen when convenient to you
For modules maintained within your organization, specifying version ranges may be appropriate if semantic versioning is used consistently or if there is a well-defined release process that avoids unwanted updates.
Step-05: vpc-module-standardized - Standardized and Generalized
In the next series of steps we are going to standardize the VPC configuration
c2-generic-variables.tf
# Input Variables# AWS Region
variable "aws_region" {
description = "Region in which AWS Resources to be created"
type = string
default = "us-east-1"
}
# Environment Variable
variable "environment" {
description = "Environment Variable used as a prefix"
type = string
default = "dev"
}
# Business Division
variable "business_divsion" {
description = "Business Division in the large organization this Infrastructure belongs"
type = string
default = "HR"
}
# VPC Output Values# VPC ID
output "vpc_id" {
description = "The ID of the VPC"
value = module.vpc.vpc_id
}
# VPC CIDR blocks
output "vpc_cidr_block" {
description = "The CIDR block of the VPC"
value = module.vpc.vpc_cidr_block
}
# VPC Private Subnets
output "private_subnets" {
description = "List of IDs of private subnets"
value = module.vpc.private_subnets
}
# VPC Public Subnets
output "public_subnets" {
description = "List of IDs of public subnets"
value = module.vpc.public_subnets
}
# VPC NAT gateway Public IP
output "nat_public_ips" {
description = "List of public Elastic IPs created for AWS NAT Gateway"
value = module.vpc.nat_public_ips
}
# VPC AZs
output "azs" {
description = "A list of availability zones spefified as argument to this module"
value = module.vpc.azs
}