Skip to content

Commit

Permalink
#22 add vpn gateway feature (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcenker authored and antonbabenko committed Nov 11, 2017
1 parent 1cdd000 commit 9bc4844
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ These types of resources are supported:
* [Route table](https://www.terraform.io/docs/providers/aws/r/route_table.html)
* [Internet Gateway](https://www.terraform.io/docs/providers/aws/r/internet_gateway.html)
* [NAT Gateway](https://www.terraform.io/docs/providers/aws/r/nat_gateway.html)
* [VPN Gateway](https://www.terraform.io/docs/providers/aws/r/vpn_gateway.html)
* [VPC Endpoint](https://www.terraform.io/docs/providers/aws/r/vpc_endpoint.html) (S3 and DynamoDB)
* [RDS DB Subnet Group](https://www.terraform.io/docs/providers/aws/r/db_subnet_group.html)
* [ElastiCache Subnet Group](https://www.terraform.io/docs/providers/aws/r/elasticache_subnet_group.html)
Expand All @@ -30,6 +31,7 @@ module "vpc" {
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]
enable_nat_gateway = true
enable_vpn_gateway = true
tags = {
Terraform = "true"
Expand Down
1 change: 1 addition & 0 deletions examples/complete-vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module "vpc" {
create_database_subnet_group = false

enable_nat_gateway = true
enable_vpn_gateway = true

enable_s3_endpoint = true
enable_dynamodb_endpoint = true
Expand Down
11 changes: 11 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,14 @@ resource "aws_route_table_association" "public" {
subnet_id = "${element(aws_subnet.public.*.id, count.index)}"
route_table_id = "${aws_route_table.public.id}"
}

##############
# VPN Gateway
##############
resource "aws_vpn_gateway" "this" {
count = "${var.enable_vpn_gateway ? 1 : 0}"

vpc_id = "${aws_vpc.this.id}"

tags = "${merge(var.tags, map("Name", format("%s", var.name)))}"
}
6 changes: 6 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,9 @@ output "vpc_endpoint_dynamodb_id" {
description = "The ID of VPC endpoint for DynamoDB"
value = "${aws_vpc_endpoint.dynamodb.id}"
}

# VPN Gateway
output "vgw_id" {
description = "The ID of the VPN Gateway"
value = "${aws_vpn_gateway.this.id}"
}
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ variable "map_public_ip_on_launch" {
default = true
}

variable "enable_vpn_gateway" {
description = "Should be true if you want to create a new VPN Gateway resource and attach it to the VPC"
default = false
}

variable "private_propagating_vgws" {
description = "A list of VGWs the private route table should propagate"
default = []
Expand Down

0 comments on commit 9bc4844

Please sign in to comment.