diff --git a/README.md b/README.md new file mode 100644 index 0000000..b17b7fb --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +# Terraform AWS VPC Module + +This Terraform module creates an AWS Virtual Private Cloud (VPC) along with public and private subnets, Internet Gateway, NAT Gateway, and relevant route tables. + +## Usage + +```hcl +provider "aws" { + region = "us-west-2" +} + +module "vpc" { + source = "./" + + vpc_cidr_block = "10.0.0.0/16" + + public_subnet_cidr_blocks = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"] + + private_subnet_cidr_blocks = ["10.0.11.0/24", "10.0.12.0/24", "10.0.13.0/24"] + + region = "us-west-2" + + availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] +} +``` +## Inputs +| Name | Description | Type | Default | Required | +|---------------------------|-----------------------------------------------------------|--------------|---------|----------| +| vpc_cidr_block | CIDR block for the VPC | string | | Yes | +| public_subnet_cidr_blocks | CIDR blocks for the public subnets | list(string) | | Yes | +| private_subnet_cidr_blocks| CIDR blocks for the private subnets | list(string) | | Yes | +| region | AWS region | string | | Yes | +| availability_zones | List of availability zones in the region | list(string) | | Yes | + +## Outputs +| Name | Description | +|-------------------------------|---------------------------------------------------| +| vpc_id | The ID of the VPC created by this module. | +| public_subnet_ids | List of IDs of the public subnets. | +| private_subnet_ids | List of IDs of the private subnets. | +| public_subnet_cidr_blocks | List of CIDR blocks of the public subnets. | +| private_subnet_cidr_blocks | List of CIDR blocks of the private subnets. | +| internet_gateway_id | The ID of the Internet Gateway. | +| nat_gateway_ids | List of IDs of the NAT Gateways. | diff --git a/outputs.tf b/outputs.tf new file mode 100644 index 0000000..6f3e0c2 --- /dev/null +++ b/outputs.tf @@ -0,0 +1,36 @@ +# outputs.tf + +output "vpc_id" { + description = "The ID of the VPC created by this module." + value = module.vpc.vpc_id +} + +output "public_subnet_ids" { + description = "List of IDs of the public subnets." + value = module.vpc.public_subnet_ids +} + +output "private_subnet_ids" { + description = "List of IDs of the private subnets." + value = module.vpc.private_subnet_ids +} + +output "public_subnet_cidr_blocks" { + description = "List of CIDR blocks of the public subnets." + value = module.vpc.public_subnet_cidr_blocks +} + +output "private_subnet_cidr_blocks" { + description = "List of CIDR blocks of the private subnets." + value = module.vpc.private_subnet_cidr_blocks +} + +output "internet_gateway_id" { + description = "The ID of the Internet Gateway." + value = module.vpc.internet_gateway_id +} + +output "nat_gateway_ids" { + description = "List of IDs of the NAT Gateways." + value = module.vpc.nat_gateway_ids +}