-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathkey.tf
40 lines (28 loc) · 980 Bytes
/
key.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
resource "tls_private_key" "k8s_cluster_access_key" {
algorithm = "ECDSA"
ecdsa_curve = "P384"
}
resource "local_file" "private_key_pem" {
depends_on = [tls_private_key.k8s_cluster_access_key]
content = tls_private_key.k8s_cluster_access_key.private_key_pem
filename = "cluster-private-key.pem"
}
resource "local_file" "public_key_pem" {
depends_on = [tls_private_key.k8s_cluster_access_key]
content = tls_private_key.k8s_cluster_access_key.public_key_pem
filename = "cluster-public-key.pem"
}
resource "local_file" "public_key_openssh" {
depends_on = [tls_private_key.k8s_cluster_access_key]
content = tls_private_key.k8s_cluster_access_key.public_key_openssh
filename = "cluster-openssh.pub"
}
resource "null_resource" "chmod" {
depends_on = [local_file.private_key_pem]
triggers = {
local_file_private_key_pem = "local_file.private_key_pem"
}
provisioner "local-exec" {
command = "chmod 600 cluster-private-key.pem"
}
}