This repository has been archived by the owner on Oct 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate a bash file that can be sourced to give useful alias
- Loading branch information
Showing
1 changed file
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
resource null_resource "build_source" { | ||
provisioner "local-exec" { | ||
command = "echo \"export KUBECONFIG=${path.module}/generated/kubeconfig\" > source.sh " | ||
} | ||
} | ||
|
||
resource null_resource "etcd-ad1" { | ||
count = "${var.etcdAd1Count}" | ||
depends_on = [ | ||
"module.instances-etcd-ad1", | ||
"null_resource.build_source" | ||
] | ||
|
||
triggers { | ||
etcd_id = "${element(module.instances-etcd-ad1.ids, count.index)}" | ||
build_source_id = "${null_resource.build_source.id}" | ||
} | ||
|
||
provisioner "local-exec" { | ||
command = "echo 'alias ${var.label_prefix}etcdad1-${count.index}=\"ssh -i ${path.module}/generated/instances_id_rsa opc@${element(module.instances-etcd-ad1.instance_public_ips, count.index)}\"' >> source.sh" | ||
} | ||
} | ||
|
||
resource null_resource "etcd-ad2" { | ||
count = "${var.etcdAd2Count}" | ||
depends_on = [ | ||
"module.instances-etcd-ad2", | ||
"null_resource.build_source" | ||
] | ||
|
||
triggers { | ||
etcd_id = "${element(module.instances-etcd-ad2.ids, count.index)}" | ||
build_source_id = "${null_resource.build_source.id}" | ||
} | ||
|
||
provisioner "local-exec" { | ||
command = "echo 'alias ${var.label_prefix}etcdad2-${count.index}=\"ssh -i ${path.module}/generated/instances_id_rsa opc@${element(module.instances-etcd-ad2.instance_public_ips, count.index)}\"' >> source.sh" | ||
} | ||
} | ||
|
||
|
||
resource null_resource "etcd-ad3" { | ||
count = "${var.etcdAd3Count}" | ||
depends_on = [ | ||
"module.instances-etcd-ad3", | ||
] | ||
|
||
triggers { | ||
etcd_id = "${element(module.instances-etcd-ad3.ids, count.index)}" | ||
build_source_id = "${null_resource.build_source.id}" | ||
} | ||
|
||
provisioner "local-exec" { | ||
command = "echo 'alias ${var.label_prefix}etcad3-${count.index}=\"ssh -i ${path.module}/generated/instances_id_rsa opc@${element(module.instances-etcd-ad3.instance_public_ips, count.index)}\"' >> source.sh" | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
resource null_resource "k8smaster-ad1" { | ||
count = "${var.k8sMasterAd1Count}" | ||
depends_on = [ | ||
"module.instances-k8smaster-ad1", | ||
] | ||
|
||
triggers { | ||
master_id = "${element(module.instances-k8smaster-ad1.ids, count.index)}" | ||
build_source_id = "${null_resource.build_source.id}" | ||
} | ||
|
||
provisioner "local-exec" { | ||
command = "echo 'alias ${var.label_prefix}masterad1-${count.index}=\"ssh -i ${path.module}/generated/instances_id_rsa opc@${element(module.instances-k8smaster-ad1.public_ips, count.index)}\"' >> source.sh" | ||
} | ||
} | ||
|
||
resource null_resource "k8smaster-ad2" { | ||
count = "${var.k8sMasterAd2Count}" | ||
depends_on = [ | ||
"module.instances-k8smaster-ad2", | ||
] | ||
|
||
triggers { | ||
master_id = "${element(module.instances-k8smaster-ad2.ids, count.index)}" | ||
build_source_id = "${null_resource.build_source.id}" | ||
} | ||
|
||
provisioner "local-exec" { | ||
command = "echo 'alias ${var.label_prefix}masterad2-${count.index}=\"ssh -i ${path.module}/generated/instances_id_rsa opc@${element(module.instances-k8smaster-ad2.public_ips, count.index)}\"' >> source.sh" | ||
} | ||
} | ||
|
||
|
||
resource null_resource "k8smaster-ad3" { | ||
count = "${var.k8sMasterAd3Count}" | ||
depends_on = [ | ||
"module.instances-k8smaster-ad3", | ||
] | ||
|
||
triggers { | ||
master_id = "${element(module.instances-k8smaster-ad3.ids, count.index)}" | ||
build_source_id = "${null_resource.build_source.id}" | ||
} | ||
|
||
provisioner "local-exec" { | ||
command = "echo 'alias ${var.label_prefix}masterad3-${count.index}=\"ssh -i ${path.module}/generated/instances_id_rsa opc@${element(module.instances-k8smaster-ad3.public_ips, count.index)}\"' >> source.sh" | ||
} | ||
} | ||
|
||
resource null_resource "k8sworker-ad1" { | ||
count = "${var.k8sWorkerAd1Count}" | ||
depends_on = [ | ||
"module.instances-k8sworker-ad1", | ||
] | ||
|
||
triggers { | ||
worker_id = "${element(module.instances-k8sworker-ad1.ids, count.index)}" | ||
build_source_id = "${null_resource.build_source.id}" | ||
} | ||
|
||
provisioner "local-exec" { | ||
command = "echo 'alias ${var.label_prefix}workerad1-${count.index}=\"ssh -i ${path.module}/generated/instances_id_rsa opc@${element(module.instances-k8sworker-ad1.public_ips, count.index)}\"' >> source.sh" | ||
} | ||
} | ||
|
||
resource null_resource "k8sworker-ad2" { | ||
count = "${var.k8sWorkerAd2Count}" | ||
depends_on = [ | ||
"module.instances-k8sworker-ad2", | ||
] | ||
|
||
triggers { | ||
worker_id = "${element(module.instances-k8sworker-ad2.ids, count.index)}" | ||
build_source_id = "${null_resource.build_source.id}" | ||
} | ||
|
||
provisioner "local-exec" { | ||
command = "echo 'alias ${var.label_prefix}workerad2-${count.index}=\"ssh -i ${path.module}/generated/instances_id_rsa opc@${element(module.instances-k8sworker-ad2.public_ips, count.index)}\"' >> source.sh" | ||
} | ||
} | ||
|
||
|
||
resource null_resource "k8sworker-ad3" { | ||
count = "${var.k8sWorkerAd3Count}" | ||
depends_on = [ | ||
"module.instances-k8sworker-ad3", | ||
] | ||
|
||
triggers { | ||
master_id = "${element(module.instances-k8sworker-ad3.ids, count.index)}" | ||
build_source_id = "${null_resource.build_source.id}" | ||
} | ||
|
||
provisioner "local-exec" { | ||
command = "echo 'alias ${var.label_prefix}workerad3-${count.index}=\"ssh -i ${path.module}/generated/instances_id_rsa opc@${element(module.instances-k8sworker-ad3.public_ips, count.index)}\"' >> source.sh" | ||
} | ||
} | ||
|