-
Notifications
You must be signed in to change notification settings - Fork 11
/
acm-server.tf
36 lines (29 loc) · 1001 Bytes
/
acm-server.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
33
34
35
36
# ACM server certificate for client VPN (for the private Airflow web server)
resource "tls_private_key" "server" {
algorithm = "RSA"
}
resource "tls_cert_request" "server" {
key_algorithm = "RSA"
private_key_pem = tls_private_key.server.private_key_pem
subject {
common_name = "${var.prefix}.mwaa-vpn.server"
organization = var.prefix
}
}
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
validity_period_hours = var.vpn_acm_validity_period_in_days * 24
allowed_uses = [
"key_encipherment",
"digital_signature",
"server_auth"
]
}
resource "aws_acm_certificate" "server" {
private_key = tls_private_key.server.private_key_pem
certificate_body = tls_locally_signed_cert.server.cert_pem
certificate_chain = tls_self_signed_cert.ca.cert_pem
}