mirror of
https://github.com/acaloiaro/sfos
synced 2026-07-21 10:12:24 +00:00
41 lines
1.2 KiB
HCL
41 lines
1.2 KiB
HCL
terraform {
|
|
required_providers {
|
|
linode = {
|
|
source = "linode/linode"
|
|
version = "2.31.1"
|
|
}
|
|
}
|
|
}
|
|
|
|
provider "linode" {
|
|
token = var.compute_provider_access_token
|
|
}
|
|
|
|
resource "linode_sshkey" "sfos_admin" {
|
|
label = "sfos-admin"
|
|
ssh_key = var.admin_ssh_public_key
|
|
}
|
|
|
|
#####################################################################################################################
|
|
# Instances
|
|
#####################################################################################################################
|
|
|
|
locals {
|
|
# These are the private IP addresses that are assigned to each node
|
|
# We start at the buttom of the cidr range + 2 because 0 is not routable and 1 is reserved; hence "i + 2" below
|
|
node_private_ips = {
|
|
value = [for i in range(var.instance_count) : "${cidrhost(var.internal_cidr_range, i + 2)}"]
|
|
}
|
|
}
|
|
|
|
resource "linode_instance" "sfos_nodes" {
|
|
count = var.instance_count
|
|
name = "sfos-${count.index}"
|
|
image = "linode/alpine3.11"
|
|
label = "sfos"
|
|
group = "sfos"
|
|
tags = ["sfos"]
|
|
region = var.compute_provider_region
|
|
type = var.compute_provider_node_type
|
|
authorized_keys = [linode_sshkey.sfos_admin.id]
|
|
}
|