-
Notifications
You must be signed in to change notification settings - Fork 0
/
beegfs.tf
100 lines (82 loc) · 2.73 KB
/
beegfs.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
terraform {
required_providers {
crusoe = {
source = "registry.terraform.io/crusoecloud/crusoe"
}
}
}
provider "crusoe" {
# Your authentication settings or configuration file details here
}
variable "public_ssh_key" {
description = "Public SSH key for instance access"
type = string
default = "todo"
}
variable "location" {
type = string
default = "us-southcentral1-a"
}
variable "project_id" {
type = string
default = "todo"
}
variable "image" {
type = string
default = "ubuntu22.04"
}
variable "connauthkey" {
type = string
# can be any value, but should be used by all nodes in the deployment
default = "12345"
}
resource "crusoe_compute_instance" "storage" {
count = 2
name = "tf-storage-${count.index}"
type = "s1a.80x"
ssh_key = var.public_ssh_key
project_id = var.project_id
location = var.location
image = var.image
startup_script = "${file("startup_scripts/general_setup.sh")}\n${templatefile("startup_scripts/storage_setup.sh.tpl", { location = var.location, connauthkey = var.connauthkey})}"
}
resource "crusoe_compute_instance" "client" {
name = "beegfs-client"
type = "c1a.4x"
ssh_key = var.public_ssh_key
project_id = var.project_id
location = var.location
image = var.image
startup_script = "${file("startup_scripts/general_setup.sh")}\n${templatefile("startup_scripts/client_setup.sh.tpl", { location = var.location, connauthkey = var.connauthkey })}"
}
resource "crusoe_compute_instance" "metadata" {
name = "metadata"
type = "c1a.4x"
ssh_key = var.public_ssh_key
project_id = var.project_id
location = var.location
image = var.image
startup_script = "${file("startup_scripts/general_setup.sh")}\n${templatefile("startup_scripts/metadata_setup.sh.tpl", { location = var.location, connauthkey = var.connauthkey })}"
}
resource "crusoe_compute_instance" "management" {
name = "management"
type = "c1a.4x"
ssh_key = var.public_ssh_key
project_id = var.project_id
location = var.location
image = var.image
startup_script = "${file("startup_scripts/general_setup.sh")}\n${templatefile("startup_scripts/management_setup.sh.tpl", { location = var.location, connauthkey = var.connauthkey })}"
}
# Output the IPs of the created instances (if applicable)
output "storage_ips" {
value = crusoe_compute_instance.storage[*].network_interfaces[0].public_ipv4
}
output "metadata_ip" {
value = crusoe_compute_instance.metadata.network_interfaces[0].public_ipv4
}
output "management_ip" {
value = crusoe_compute_instance.management.network_interfaces[0].public_ipv4
}
output "client_ip" {
value = crusoe_compute_instance.client.network_interfaces[0].public_ipv4
}