Added write_aws_auth_config option (#228)

* Added update aws auth configmap when manage_aws_auth set false case
and `write_aws_auth_config` variable for not create the aws_auth files option

* Add CHANGELOG

* Changed writing config file process for Windows compatibility.

* Apply terraform-docs and terraform fmt

* Fixed zsh-specific syntax

* Fixed CHANGELOG.md
This commit is contained in:
yutachaos
2019-02-01 21:02:41 +09:00
committed by Max Williams
parent 35747d707a
commit d3c1bd6237
4 changed files with 26 additions and 6 deletions

View File

@@ -1,20 +1,32 @@
resource "local_file" "config_map_aws_auth" {
content = "${data.template_file.config_map_aws_auth.rendered}"
filename = "${var.config_output_path}config-map-aws-auth_${var.cluster_name}.yaml"
count = "${var.manage_aws_auth ? 1 : 0}"
count = "${var.write_aws_auth_config ? 1 : 0}"
}
resource "null_resource" "update_config_map_aws_auth" {
depends_on = ["aws_eks_cluster.this"]
provisioner "local-exec" {
command = "for i in `seq 1 10`; do kubectl apply -f ${var.config_output_path}config-map-aws-auth_${var.cluster_name}.yaml --kubeconfig ${var.config_output_path}kubeconfig_${var.cluster_name} && exit 0 || sleep 10; done; exit 1"
working_dir = "${path.module}"
command = <<EOS
for i in `seq 1 10`; do \
echo "${null_resource.update_config_map_aws_auth.triggers.kube_config_map_rendered}" > kube_config.yaml & \
echo "${null_resource.update_config_map_aws_auth.triggers.config_map_rendered}" > aws_auth_configmap.yaml & \
kubectl apply -f aws_auth_configmap.yaml --kubeconfig kube_config.yaml && break || \
sleep 10; \
done; \
rm aws_auth_configmap.yaml kube_config.yaml;
EOS
interpreter = ["${var.local_exec_interpreter}"]
}
triggers {
config_map_rendered = "${data.template_file.config_map_aws_auth.rendered}"
endpoint = "${aws_eks_cluster.this.endpoint}"
kube_config_map_rendered = "${data.template_file.kubeconfig.rendered}"
config_map_rendered = "${data.template_file.config_map_aws_auth.rendered}"
endpoint = "${aws_eks_cluster.this.endpoint}"
}
count = "${var.manage_aws_auth ? 1 : 0}"