Skip to content

Commit

Permalink
add readme and output
Browse files Browse the repository at this point in the history
  • Loading branch information
Prashanna_31 committed Mar 14, 2024
1 parent c37fb82 commit fd18f24
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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. |
36 changes: 36 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit fd18f24

Please sign in to comment.