vpc-basic¶
Minimal, zero-cost example of the vpc module:
- A
10.0.0.0/16VPC spread across 2 availability zones (var.azs, defaults tous-east-1a/us-east-1b). - One public and one private subnet per AZ.
- NAT gateway disabled (
enable_nat_gateway = false), so nothing billed per hour is created. Private subnets have no outbound internet access; the free S3 gateway endpoint is kept. - Example tags (
Project,Example,Environment,ManagedBy) applied to every resource.
Usage¶
Requires AWS credentials for the target account in your environment.
terraform init
terraform plan
terraform apply
To deploy into another region, pass two AZs of that region too:
terraform apply -var="region=eu-west-1" -var='azs=["eu-west-1a","eu-west-1b"]'
Clean up when you are done (with the same -var flags you applied with):
terraform destroy
The outputs vpc_id, public_subnet_ids and private_subnet_ids can be passed to other
modules, for example eks.
Requirements¶
| Name | Version |
|---|---|
| terraform | >= 1.6.0 |
| aws | >= 5.0 |
Providers¶
No providers.
Modules¶
| Name | Source | Version |
|---|---|---|
| vpc | ../../modules/vpc | n/a |
Resources¶
No resources.
Inputs¶
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| azs | Exactly two availability zones in region to spread the subnets across. |
list(string) |
[ |
no |
| region | AWS region to deploy the example into. | string |
"us-east-1" |
no |
Outputs¶
| Name | Description |
|---|---|
| private_subnet_ids | IDs of the private subnets, one per availability zone. |
| public_subnet_ids | IDs of the public subnets, one per availability zone. |
| vpc_id | ID of the VPC created by the example. |