You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
723 B

terraform {
required_providers {
digitalocean = {
source = "digitalocean/digitalocean"
version = "~> 2.0"
}
}
}
resource "digitalocean_tag" "cluster" {
name = "${var.name}"
}
resource "digitalocean_ssh_key" "cluster" {
name = "${var.name}"
public_key = "${file(var.ssh_key)}"
}
resource "digitalocean_droplet" "cluster" {
name = "${var.name}-node${count.index}"
image = "centos-7-x64"
size = "${var.instance_size}"
region = "${element(var.regions, count.index)}"
ssh_keys = ["${digitalocean_ssh_key.cluster.id}"]
count = "${var.servers}"
tags = ["${digitalocean_tag.cluster.id}"]
lifecycle = {
prevent_destroy = false
}
connection {
timeout = "30s"
}
}