-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
40 lines (32 loc) · 985 Bytes
/
main.tf
File metadata and controls
40 lines (32 loc) · 985 Bytes
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
# Yandex.Cloud Compute Instances
resource "yandex_compute_instance" "server" {
for_each = var.servers
name = each.key
platform_id = each.value.platform_id
zone = each.value.zone
allow_stopping_for_update = true
resources {
cores = each.value.cores
core_fraction = each.value.core_fraction
memory = each.value.memory
}
boot_disk {
initialize_params {
image_id = each.value.image_id
size = each.value.disk_size
type = each.value.disk_type
}
}
network_interface {
subnet_id = each.value.subnet_id
security_group_ids = each.value.security_group_ids
nat = true #checkov:skip=CKV_YC_2:Public IP is required for VPS
nat_ip_address = each.value.nat_ip_address
}
metadata = {
ssh-keys = join("\n", [for name, key in var.ssh_keys : "ubuntu:${key}"])
}
lifecycle {
ignore_changes = [boot_disk[0].initialize_params[0].image_id]
}
}