https://github.com/scholzj/aws-vpc
Terraform configuration for creating s simple Amazon AWS VPC and subnets
https://github.com/scholzj/aws-vpc
aws aws-vpc terraform terraform-configurations
Last synced: 8 months ago
JSON representation
Terraform configuration for creating s simple Amazon AWS VPC and subnets
- Host: GitHub
- URL: https://github.com/scholzj/aws-vpc
- Owner: scholzj
- License: apache-2.0
- Created: 2017-09-24T21:34:12.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-27T21:50:35.000Z (over 7 years ago)
- Last Synced: 2025-01-31T01:11:18.095Z (9 months ago)
- Topics: aws, aws-vpc, terraform, terraform-configurations
- Language: HCL
- Size: 6.84 KB
- Stars: 6
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Amazon AWS VPC
This Terraform configuration creates:
* Amazon AWS VPC
* Internet Gateway
* Subnets in all configured availability zones and routing tables linking them to the Internet GatewayAdditionally, if variable `private_subnets` is set to true, it will create:
* NAT with Elastic IP address in each availability zone
* Private subnet in each availability zone with routing tables linking them to the NATThis configuration uses my own module from [Terraform Module Registry](https://registry.terraform.io/modules/scholzj/vpc/aws/).
- [Amazon AWS VPC](#amazon-aws-vpc)
- [Prerequisites and dependencies](#prerequisites-and-dependencies)
- [Configuration](#configuration)
- [Creating the VPC](#creating-the-vpc)
- [Deleting the VPC](#deleting-the-vpc)## Prerequisites and dependencies
There are no other dependencies apart from [Terraform](https://www.terraform.io).
## Configuration
| Option | Explanation | Example |
|--------|-------------|---------|
| `aws_region` | AWS region which should be used | `eu-central-1` |
| `aws_zones` | List of AWS availability zones which should be used | `["eu-central-1a", "eu-central-1b"]` |
| `vpc_name` | Name of the VPC which should ve created | `my-vpc` |
| `vpc_cidr` | CIDR address which should be used | `10.0.0.0/16` |
| `tags` | Tags which should be applied to all resources | `{ Hello = "World" }` |
| `private_subnets` | Create also private subnets with NAT in every avaialbility zone | `false` or `true` |## Creating the VPC
To create the VPC,
* Export AWS credentials into environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`
* Apply Terraform configuration:
```bash
terraform init
terraform apply --var-file example.tfvars
```## Deleting the VPC
To delete the VPC,
* Export AWS credentials into environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`
* Destroy Terraform configuration:
```bash
terraform destroy --var-file example.tfvars
```