File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,14 @@ resource aws_ec2_client_vpn_authorization_rule ingress-all {
5959 description = " Allow all VPN groups access to ${ var . allowed_ingress_network_cidr } "
6060}
6161
62+ resource aws_ec2_client_vpn_route internet-access {
63+ count = var. enable_internet_access ? 1 : 0
64+ for_each = toset (var. subnet_ids )
65+ client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint. default . id
66+ destination_cidr_block = " 0.0.0.0/0"
67+ target_vpc_subnet_id = aws_ec2_client_vpn_network_association. default [each . key ]. subnet_id
68+ }
69+
6270data "aws_region" "current" {}
6371
6472# 'Borrowed' from: https://github.com/achuchulev/terraform-aws-client-vpn-endpoint/blob/master/main.tf
Original file line number Diff line number Diff line change @@ -22,6 +22,12 @@ variable "security_groups" {
2222 default = null
2323}
2424
25+ variable "enable_internet_access" {
26+ type = bool
27+ description = " If true, add a route to 0.0.0.0/0 on VPN endpoint route table. Your VPN subnet must also have a route to an Internet Gateway."
28+ default = false
29+ }
30+
2531// Authentication
2632
2733variable "cert_dir" {
You can’t perform that action at this time.
0 commit comments