forked from blue-harvest/terraform-aws-blueharvest-eks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
37 lines (29 loc) · 960 Bytes
/
main.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
data "aws_ami" "ubuntu" {
most_recent = true
owners = ["099720109477"]
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20180306"]
}
}
provider "tls" {}
resource "tls_private_key" "mutanthost-eks" {
algorithm = "RSA"
rsa_bits = "2048"
provisioner "local-exec" {
command = "echo \"${tls_private_key.mutanthost-eks.private_key_pem}\" >> ./\"${var.cluster_name}\"_key"
interpreter = ["/bin/sh", "-c"]
}
provisioner "local-exec" {
command = "echo \"${tls_private_key.mutanthost-eks.private_key_pem}\" >> ./\"${var.cluster_name}\"_key.pub"
interpreter = ["/bin/sh", "-c"]
}
provisioner "local-exec" {
command = "chmod 600 \"${var.cluster_name}\"_key"
interpreter = ["/bin/sh", "-c"]
}
}
resource "aws_key_pair" "mutanthost-eks" {
key_name = "${var.cluster_name}"
public_key = "${tls_private_key.mutanthost-eks.public_key_openssh}"
}