forked from DNXLabs/terraform-aws-client-vpn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vpn-endpoint.tf
32 lines (27 loc) · 1.05 KB
/
vpn-endpoint.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
resource "aws_ec2_client_vpn_endpoint" "default" {
description = var.name
server_certificate_arn = aws_acm_certificate.server.arn
client_cidr_block = var.cidr
split_tunnel = var.split_tunnel
authentication_options {
type = "certificate-authentication"
root_certificate_chain_arn = aws_acm_certificate.root.arn
}
connection_log_options {
enabled = true
cloudwatch_log_group = aws_cloudwatch_log_group.vpn.name
cloudwatch_log_stream = aws_cloudwatch_log_stream.vpn.name
}
tags = var.tags
}
resource "aws_ec2_client_vpn_network_association" "default" {
count = length(var.subnet_ids)
client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.default.id
subnet_id = element(var.subnet_ids, count.index)
}
resource "aws_ec2_client_vpn_authorization_rule" "default" {
client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.default.id
target_network_cidr = "0.0.0.0/0"
authorize_all_groups = true
description = var.name
}