-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.tf
64 lines (56 loc) · 1.31 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
resource "google_compute_instance" "vm_instance" {
name = "sol-node-vm"
machine_type = "n2-highmem-64" // (32 cores, 512 GB memory)
zone = "us-central1-a"
boot_disk {
initialize_params {
image = "ubuntu-os-cloud/ubuntu-2004-lts"
size = 50
}
}
network_interface {
network = "default"
nic_type = "GVNIC"
access_config {
nat_ip = google_compute_address.static_ip.address
}
}
attached_disk {
mode = "READ_WRITE"
source = google_compute_disk.vm_disk.id
}
tags = ["sol-node-vm"]
depends_on = [
google_compute_disk.vm_disk,
google_compute_address.static_ip,
google_compute_firewall.solana_firewall,
]
}
resource "google_compute_disk" "vm_disk" {
name = "sol-node-disk"
type = "pd-ssd"
size = 2000
zone = "us-central1-a"
lifecycle {
prevent_destroy = true
}
}
resource "google_compute_address" "static_ip" {
name = "sol-node-static-ip"
address_type = "EXTERNAL"
region = "us-central1"
}
resource "google_compute_firewall" "solana_firewall" {
name = "allow-solana-ports"
network = "default"
allow {
protocol = "tcp"
ports = ["8899", "8900", "8001"]
}
allow {
protocol = "udp"
ports = ["8000-8020"]
}
source_ranges = ["0.0.0.0/0"]
target_tags = ["sol-node-vm"]
}