-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcert_ca.tf
39 lines (34 loc) · 884 Bytes
/
cert_ca.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
37
38
39
// generate CA including ca.pem and ca-key.pem
resource "tls_private_key" "ca" {
algorithm = "RSA"
}
resource "tls_self_signed_cert" "ca" {
key_algorithm = tls_private_key.ca.algorithm
private_key_pem = tls_private_key.ca.private_key_pem
# Certificate expires after 12 hours.
validity_period_hours = 8760
is_ca_certificate = true
allowed_uses = [
"key_encipherment",
"cert_signing",
"server_auth",
"client_auth"
]
subject {
common_name = "Kubernetes"
organization = "Kubernetes"
organizational_unit = "CA"
country = "AU"
province = "NSW"
locality = "Sydney"
}
}
//resource "local_file" "ca-pem" {
// filename = "certs/ca.pem"
// sensitive_content = tls_self_signed_cert.ca.cert_pem
//}
//
//resource "local_file" "ca-key-pem" {
// filename = "certs/ca-key.pem"
// sensitive_content = tls_private_key.ca.private_key_pem
//}