kubectl now configurable by the module

This commit is contained in:
brandoconnor
2018-06-08 02:54:18 -07:00
parent 951f8f349e
commit 99dac053b7
5 changed files with 47 additions and 20 deletions

26
main.tf
View File

@@ -29,7 +29,6 @@
* subnets = ["subnet-abcde012", "subnet-bcde012a"]
* tags = "${map("Environment", "test")}"
* vpc_id = "vpc-abcde012"
* workers_ami_id = "ami-123456"
* cluster_ingress_cidrs = ["24.18.23.91/32"]
* }
* ```
@@ -88,3 +87,28 @@ To test your kubectl connection manually, see the [eks_test_fixture README](http
provider "null" {}
provider "template" {}
resource "local_file" "kubeconfig" {
content = "${data.template_file.kubeconfig.rendered}"
filename = "${var.config_output_path}/kubeconfig"
count = "${var.configure_kubectl_session ? 1 : 0}"
}
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.yaml"
count = "${var.configure_kubectl_session ? 1 : 0}"
}
resource "null_resource" "configure_kubectl" {
provisioner "local-exec" {
command = "kubectl apply -f ${var.config_output_path}/config-map-aws-auth.yaml --kubeconfig ${var.config_output_path}/kubeconfig"
}
triggers {
config_map_rendered = "${data.template_file.config_map_aws_auth.rendered}"
kubeconfig_rendered = "${data.template_file.kubeconfig.rendered}"
}
count = "${var.configure_kubectl_session ? 1 : 0}"
}