-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.tf
48 lines (40 loc) · 1.54 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
# define nodes in a cloud-agnostic way
module "nodes" {
source = "./modules/node"
cloud_provider = "${var.cloud_provider}"
node_name = "${var.node_name}"
node_count = "${var.node_count}"
private_key = "${var.private_key}"
hetzner_server_image = "${var.hetzner_server_image}"
hetzner_server_type = "${var.hetzner_server_type}"
scaleway_server_arch = "${var.scaleway_server_arch}"
scaleway_server_image = "${var.scaleway_server_image}"
scaleway_server_type = "${var.scaleway_server_type}"
aws_region = "${var.aws_region}"
aws_ami_name_filter = "${var.aws_ami_name_filter}"
aws_ami_virtualization_type_filter = "${var.aws_ami_virtualization_type_filter}"
aws_ami_owners = "${var.aws_ami_owners}"
aws_instance_type = "${var.aws_instance_type}"
}
terraform {
# The configuration for this backend will be filled in by Terragrunt
backend "s3" {}
}
# install a package on created nodes
resource "null_resource" "git" {
count = "${var.node_count}"
triggers {
cloud_provider = "${var.cloud_provider}"
}
connection {
host = "${element(module.nodes.public_ip, count.index)}"
user = "${var.ssh_user}"
private_key = "${file(var.private_key)}"
}
provisioner "remote-exec" {
inline = [
"sudo apt update",
"sudo apt install -y git",
]
}
}