-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor split submodule scripts (#79)
* Refactor the split bash script orchestration * precommit * Add descriptions to new outputs * pwd/ls to debug weird path problem in circle * Sorry, this one * Make example easy to run w/unique name * Less silly hash generation * Switch to terraform_data
- Loading branch information
1 parent
80f8bfc
commit 35f0247
Showing
11 changed files
with
74 additions
and
63 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
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
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
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
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 |
---|---|---|
@@ -1,25 +1,47 @@ | ||
locals { | ||
run_setup = var.bastion_info != null || var.eks.public_access.enabled ? 1 : 0 | ||
} | ||
|
||
module "k8s_setup" { | ||
count = var.bastion_info != null || var.eks.public_access.enabled ? 1 : 0 | ||
count = local.run_setup | ||
|
||
source = "../k8s" | ||
ssh_key = var.ssh_key | ||
bastion_info = var.bastion_info | ||
network_info = var.network_info | ||
eks_info = local.eks_info | ||
cluster_setup = true | ||
source = "../k8s" | ||
ssh_key = var.ssh_key | ||
bastion_info = var.bastion_info | ||
network_info = var.network_info | ||
eks_info = local.eks_info | ||
|
||
depends_on = [aws_eks_addon.vpc_cni, null_resource.kubeconfig] | ||
} | ||
|
||
module "calico_setup" { | ||
count = var.bastion_info != null || var.eks.public_access.enabled ? 1 : 0 | ||
resource "terraform_data" "run_k8s_pre_setup" { | ||
count = local.run_setup | ||
|
||
triggers_replace = [ | ||
module.k8s_setup[0].change_hash | ||
] | ||
|
||
provisioner "local-exec" { | ||
command = "./${module.k8s_setup[0].filename} set_k8s_auth set_eniconfig" | ||
interpreter = ["bash", "-c"] | ||
working_dir = module.k8s_setup[0].resources_directory | ||
} | ||
|
||
depends_on = [module.k8s_setup] | ||
} | ||
|
||
resource "terraform_data" "calico_setup" { | ||
count = local.run_setup | ||
|
||
triggers_replace = [ | ||
module.k8s_setup[0].change_hash | ||
] | ||
|
||
source = "../k8s" | ||
ssh_key = var.ssh_key | ||
bastion_info = var.bastion_info | ||
network_info = var.network_info | ||
eks_info = local.eks_info | ||
install_calico = true | ||
provisioner "local-exec" { | ||
command = "./${module.k8s_setup[0].filename} install_calico" | ||
interpreter = ["bash", "-c"] | ||
working_dir = module.k8s_setup[0].resources_directory | ||
} | ||
|
||
depends_on = [aws_eks_node_group.node_groups, module.k8s_setup] | ||
depends_on = [aws_eks_node_group.node_groups, terraform_data.run_k8s_pre_setup] | ||
} |
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
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
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
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,14 @@ | ||
output "change_hash" { | ||
description = "Hash of all templated files" | ||
value = local.change_hash | ||
} | ||
|
||
output "filename" { | ||
description = "Filename of primary script" | ||
value = basename(local_file.templates["k8s_presetup"].filename) | ||
} | ||
|
||
output "resources_directory" { | ||
description = "Directory for provisioned scripts and templated files" | ||
value = local.resources_directory | ||
} |
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
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