-
Notifications
You must be signed in to change notification settings - Fork 0
/
tls.tf
59 lines (47 loc) · 1.42 KB
/
tls.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Copyright © 2023, Oracle and/or its affiliates.
# All rights reserved. The Universal Permissive License (UPL), Version 1.0 as shown at http://oss.oracle.com/licenses/upl
resource "tls_private_key" "acme_ca" {
algorithm = "RSA"
rsa_bits = "4096"
}
resource "tls_self_signed_cert" "acme_ca" {
private_key_pem = tls_private_key.acme_ca.private_key_pem
is_ca_certificate = true
subject {
common_name = "Acme Self Signed CA"
organization = "Acme Self Signed"
organizational_unit = "acme"
}
validity_period_hours = 87659
allowed_uses = [
"digital_signature",
"cert_signing",
"crl_signing",
]
}
resource "tls_private_key" "example_com" {
algorithm = "RSA"
rsa_bits = "4096"
}
resource "tls_cert_request" "example_com" {
private_key_pem = tls_private_key.example_com.private_key_pem
dns_names = ["example.com"]
subject {
common_name = "example.com"
organization = "Example Self Signed"
country = "GB"
organizational_unit = "example.com"
}
}
resource "tls_locally_signed_cert" "example_com" {
cert_request_pem = tls_cert_request.example_com.cert_request_pem
ca_private_key_pem = tls_private_key.acme_ca.private_key_pem
ca_cert_pem = tls_self_signed_cert.acme_ca.cert_pem
validity_period_hours = 87659
allowed_uses = [
"digital_signature",
"key_encipherment",
"server_auth",
"client_auth",
]
}