add AliCloud host to swarm

This commit is contained in:
Jakub Sokołowski 2018-08-28 10:26:31 -04:00
parent b904afd2d3
commit 4dc5b1f87b
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
5 changed files with 50 additions and 7 deletions

View File

@ -59,3 +59,12 @@ module "swarm" {
"30399-30399", /* swarm */
]
}
resource "cloudflare_record" "swarm" {
domain = "${var.domain}"
name = "${var.env}-${terraform.workspace}"
value = "${element(module.swarm.public_ips, count.index)}"
count = "${local.ws["hosts_count"]}"
type = "A"
ttl = 3600
}

View File

@ -1,3 +1,3 @@
output "public_ip" {
output "public_ips" {
value = ["${digitalocean_floating_ip.host.*.ip_address}"]
}

View File

@ -1,3 +1,3 @@
output "public_ip" {
output "public_ips" {
value = ["${google_compute_instance.host.*.network_interface.0.access_config.0.assigned_nat_ip }"]
}

View File

@ -9,7 +9,7 @@
/* Digital Ocean */
module "digital-ocean-ams3" {
module "do-ams3" {
source = "../digital-ocean"
/* specific */
name = "${var.name}"
@ -28,7 +28,7 @@ module "digital-ocean-ams3" {
resource "cloudflare_record" "do-ams3" {
domain = "${var.domain}"
name = "nodes.do-ams3.${var.env}.${terraform.workspace}"
value = "${element(module.digital-ocean-ams3.public_ip, count.index)}"
value = "${element(module.do-ams3.public_ips, count.index)}"
count = "${var.count}"
type = "A"
ttl = 3600
@ -36,7 +36,7 @@ resource "cloudflare_record" "do-ams3" {
/* Google Cloud */
module "google-cloud-us-central1" {
module "gc-us-central1-a" {
source = "../google-cloud"
/* specific */
name = "${var.name}"
@ -54,10 +54,37 @@ module "google-cloud-us-central1" {
open_ports = "${var.open_ports}"
}
resource "cloudflare_record" "gc-us-central1" {
resource "cloudflare_record" "gc-us-central1-a" {
domain = "${var.domain}"
name = "nodes.gc-us-central1-a.${var.env}.${terraform.workspace}"
value = "${element(module.google-cloud-us-central1.public_ip, count.index)}"
value = "${element(module.gc-us-central1-a.public_ips, count.index)}"
count = "${var.count}"
type = "A"
ttl = 3600
}
/* Alibaba Cloud */
module "ac-cn-hongkong-c" {
source = "../alibaba-cloud"
/* specific */
name = "${var.name}"
count = "${var.count}"
env = "${var.env}"
group = "${var.group}"
/* scaling */
type = "${var.ac_size}"
zone = "cn-hongkong-c"
/* general */
domain = "${var.domain}"
/* firewall */
open_ports = "${var.open_ports}"
}
resource "cloudflare_record" "ac-cn-hongkong-c" {
domain = "${var.domain}"
name = "nodes.ac-cn-hongkong-c.${var.env}.${terraform.workspace}"
value = "${element(module.ac-cn-hongkong-c.public_ips, count.index)}"
count = "${var.count}"
type = "A"
ttl = 3600

View File

@ -0,0 +1,7 @@
output "public_ips" {
value = [
"${module.do-ams3.public_ips}",
"${module.gc-us-central1-a.public_ips}",
"${module.ac-cn-hongkong-c.public_ips}",
]
}