mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-03-23 09:51:04 +01:00
kubectl now configurable by the module
This commit is contained in:
26
main.tf
26
main.tf
@@ -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}"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user