Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed issue with cert resources not able to define encryption on read… #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ The following resources will be created:
| subnet\_ids | Subnet ID to associate clients (each subnet passed will create an VPN association - costs involved) | `list(string)` | n/a | yes |
| tags | Extra tags to attach to resources | `map(string)` | `{}` | no |
| vpc\_id | VPC Id to create resources | `string` | n/a | yes |
| transport\_protocol | (Optional) The transport protocol to be used by the VPN session. (Default value is `udp`). | `string` | udp | no |

| session_timeout_hours | (Optional) The maximum session duration is a trigger by which end-users are required to re-authenticate prior to establishing a VPN session. (Default value is `24` - Valid values: `8` | `10` | `12` | `24`) | `number` | `24` | no |
| login_banner_text | (Optional) Customizable text that will be displayed in a banner on AWS provided clients when a VPN session is established. UTF-8 encoded characters only. Maximum of 1400 characters. | `string` | `null` | no |


## Outputs

Expand All @@ -53,6 +58,7 @@ The following resources will be created:
| vpn\_client\_cert | n/a |
| vpn\_client\_key | n/a |
| vpn\_endpoint\_id | n/a |
| vpn\_dns\_name | n/a |

<!--- END_TF_DOCS --->

Expand Down
3 changes: 3 additions & 0 deletions _outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ output "vpn_client_cert" {
output "vpn_client_key" {
value = tls_private_key.root.private_key_pem
}
output "vpn_dns_name" {
value = aws_ec2_client_vpn_endpoint.default.dns_name
}
19 changes: 19 additions & 0 deletions _variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,22 @@ variable "enable_self_service_portal" {
default = false
description = "Specify whether to enable the self-service portal for the Client VPN endpoint"
}

variable "transport_protocol" {
type = string
default = "udp"
description = "(Optional) The transport protocol to be used by the VPN session. (Default value is `udp`)."
}

variable "session_timeout_hours" {
type = number
default = 24
description = "(Optional) The maximum session duration is a trigger by which end-users are required to re-authenticate prior to establishing a VPN session. (Default value is `24` - Valid values: `8` | `10` | `12` | `24`)"
}

variable "login_banner_text" {
type = string
default = null
description = "(Optional) Customizable text that will be displayed in a banner on AWS provided clients when a VPN session is established. UTF-8 encoded characters only. Maximum of 1400 characters."
}

1 change: 0 additions & 1 deletion acm-certificate-ca.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ resource "tls_private_key" "ca" {
}

resource "tls_self_signed_cert" "ca" {
key_algorithm = "RSA"
private_key_pem = tls_private_key.ca.private_key_pem

subject {
Expand Down
2 changes: 0 additions & 2 deletions acm-certificate-root.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ resource "tls_private_key" "root" {
}

resource "tls_cert_request" "root" {
key_algorithm = "RSA"
private_key_pem = tls_private_key.root.private_key_pem

subject {
Expand All @@ -14,7 +13,6 @@ resource "tls_cert_request" "root" {

resource "tls_locally_signed_cert" "root" {
cert_request_pem = tls_cert_request.root.cert_request_pem
ca_key_algorithm = "RSA"
ca_private_key_pem = tls_private_key.ca.private_key_pem
ca_cert_pem = tls_self_signed_cert.ca.cert_pem

Expand Down
2 changes: 0 additions & 2 deletions acm-certificate-server.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ resource "tls_private_key" "server" {
}

resource "tls_cert_request" "server" {
key_algorithm = "RSA"
private_key_pem = tls_private_key.server.private_key_pem

subject {
Expand All @@ -14,7 +13,6 @@ resource "tls_cert_request" "server" {

resource "tls_locally_signed_cert" "server" {
cert_request_pem = tls_cert_request.server.cert_request_pem
ca_key_algorithm = "RSA"
ca_private_key_pem = tls_private_key.ca.private_key_pem
ca_cert_pem = tls_self_signed_cert.ca.cert_pem

Expand Down
10 changes: 10 additions & 0 deletions vpn-endpoint.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ resource "aws_ec2_client_vpn_endpoint" "default" {
split_tunnel = var.split_tunnel
dns_servers = var.dns_servers
self_service_portal = local.self_service_portal
transport_protocol = var.transport_protocol
session_timeout_hours = var.session_timeout_hours

authentication_options {
type = var.authentication_type
Expand All @@ -18,6 +20,14 @@ resource "aws_ec2_client_vpn_endpoint" "default" {
cloudwatch_log_stream = aws_cloudwatch_log_stream.vpn.name
}

dynamic "client_login_banner_options" {
for_each = var.login_banner_text == null? [] : [var.login_banner_text]
content {
banner_text = var.login_banner_text
enabled = true
}
}

tags = merge(
var.tags,
tomap({
Expand Down