aboutsummaryrefslogtreecommitdiffstats
path: root/terraform/kubeconfig.tf
diff options
context:
space:
mode:
Diffstat (limited to 'terraform/kubeconfig.tf')
-rw-r--r--terraform/kubeconfig.tf58
1 files changed, 58 insertions, 0 deletions
diff --git a/terraform/kubeconfig.tf b/terraform/kubeconfig.tf
new file mode 100644
index 0000000..7a923b6
--- /dev/null
+++ b/terraform/kubeconfig.tf
@@ -0,0 +1,58 @@
+locals {
+ kubeconfig = <<KUBECONFIG
+
+
+apiVersion: v1
+clusters:
+- cluster:
+ server: ${aws_eks_cluster.sensyne_demo_cluster.endpoint}
+ certificate-authority-data: ${aws_eks_cluster.sensyne_demo_cluster.certificate_authority.0.data}
+ name: kubernetes
+contexts:
+- context:
+ cluster: kubernetes
+ user: aws
+ name: aws
+current-context: aws
+kind: Config
+preferences: {}
+users:
+- name: aws
+ user:
+ exec:
+ apiVersion: client.authentication.k8s.io/v1alpha1
+ command: aws-iam-authenticator
+ args:
+ - "token"
+ - "-i"
+ - "${var.cluster_name}"
+KUBECONFIG
+}
+
+output "kubeconfig" {
+ value = "${local.kubeconfig}"
+}
+
+locals {
+ config_map_aws_auth = <<CONFIGMAPAWSAUTH
+
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: aws-auth
+ namespace: kube-system
+data:
+ mapRoles: |
+ - rolearn: ${aws_iam_role.sensyne_demo_node.arn}
+ username: system:node:{{EC2PrivateDNSName}}
+ groups:
+ - system:bootstrappers
+ - system:nodes
+CONFIGMAPAWSAUTH
+}
+
+output "config_map_aws_auth" {
+ value = "${local.config_map_aws_auth}"
+}
+