mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-19 22:44:24 +00:00
add terraforce deployment method
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* Cluster on DO
|
||||
*
|
||||
*/
|
||||
|
||||
variable "name" {
|
||||
description = "The cluster name, e.g cdn"
|
||||
}
|
||||
|
||||
variable "environment" {
|
||||
description = "Environment tag, e.g prod"
|
||||
}
|
||||
|
||||
variable "image_id" {
|
||||
description = "Image ID"
|
||||
}
|
||||
|
||||
variable "regions" {
|
||||
description = "Regions to launch in"
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "key_ids" {
|
||||
description = "SSH keys to use"
|
||||
type = "list"
|
||||
}
|
||||
|
||||
variable "instance_size" {
|
||||
description = "The instance size to use, e.g 2gb"
|
||||
}
|
||||
|
||||
variable "desired_capacity" {
|
||||
description = "Desired instance count"
|
||||
default = 3
|
||||
}
|
||||
|
||||
#-----------------------
|
||||
# Instances
|
||||
|
||||
resource "digitalocean_droplet" "cluster" {
|
||||
# set the image and instance type
|
||||
name = "${var.name}${count.index}"
|
||||
image = "${var.image_id}"
|
||||
size = "${var.instance_size}"
|
||||
|
||||
# the `element` function handles modulo
|
||||
region = "${element(var.regions, count.index)}"
|
||||
|
||||
ssh_keys = "${var.key_ids}"
|
||||
|
||||
count = "${var.desired_capacity}"
|
||||
lifecycle = {
|
||||
prevent_destroy = false
|
||||
}
|
||||
}
|
||||
|
||||
#-----------------------
|
||||
|
||||
// The cluster name, e.g cdn
|
||||
output "name" {
|
||||
value = "${var.name}"
|
||||
}
|
||||
|
||||
// The list of cluster instance ids
|
||||
output "instances" {
|
||||
value = ["${digitalocean_droplet.cluster.*.id}"]
|
||||
}
|
||||
|
||||
// The list of cluster instance ips
|
||||
output "private_ips" {
|
||||
value = ["${digitalocean_droplet.cluster.*.ipv4_address_private}"]
|
||||
}
|
||||
|
||||
// The list of cluster instance ips
|
||||
output "public_ips" {
|
||||
value = ["${digitalocean_droplet.cluster.*.ipv4_address}"]
|
||||
}
|
||||
Reference in New Issue
Block a user