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.

28 lines
586 B

  1. resource "digitalocean_tag" "cluster" {
  2. name = "${var.name}"
  3. }
  4. resource "digitalocean_ssh_key" "cluster" {
  5. name = "${var.name}"
  6. public_key = "${file(var.ssh_key)}"
  7. }
  8. resource "digitalocean_droplet" "cluster" {
  9. name = "${var.name}-node${count.index}"
  10. image = "centos-7-x64"
  11. size = "${var.instance_size}"
  12. region = "${element(var.regions, count.index)}"
  13. ssh_keys = ["${digitalocean_ssh_key.cluster.id}"]
  14. count = "${var.servers}"
  15. tags = ["${digitalocean_tag.cluster.id}"]
  16. lifecycle = {
  17. prevent_destroy = false
  18. }
  19. connection {
  20. timeout = "30s"
  21. }
  22. }