infrastructure/terraform/servers.tf

35 строки
1.0 KiB
Terraform
Исходник Постоянная ссылка Обычный вид История

2016-12-14 16:43:27 +03:00
resource "digitalocean_droplet" "server" {
count = "${var.server_count}"
name = "${lookup(var.server_names, count.index)}"
image = "${lookup(var.server_images, count.index)}"
region = "${lookup(var.server_regions, count.index)}"
size = "${lookup(var.server_sizes, count.index)}"
user_data = "${data.template_file.user_data.rendered}"
2016-11-08 18:27:16 +03:00
2016-12-14 16:43:27 +03:00
ssh_keys = ["${digitalocean_ssh_key.owners.*.id}"]
ipv6 = true
backups = true
private_networking = false
2018-03-31 02:57:20 +03:00
resize_disk = true
2016-11-08 18:27:16 +03:00
}
2016-12-14 16:43:27 +03:00
resource "cloudflare_record" "serverv4" {
count = "${var.server_count}"
name = "${lookup(var.server_names, count.index)}"
2016-11-09 11:58:20 +03:00
2016-12-14 16:43:27 +03:00
domain = "${var.cloudflare_domain}"
value = "${element(digitalocean_droplet.server.*.ipv4_address, count.index)}"
type = "A"
2016-11-08 18:27:16 +03:00
}
2016-12-14 16:43:27 +03:00
resource "cloudflare_record" "serverv6" {
count = "${var.server_count}"
name = "${lookup(var.server_names, count.index)}"
domain = "${var.cloudflare_domain}"
value = "${element(digitalocean_droplet.server.*.ipv6_address, count.index)}"
type = "AAAA"
2016-11-08 18:27:16 +03:00
}