mirror of
https://github.com/farcasclaudiu/terraform-course.git
synced 2026-06-29 01:02:16 +03:00
eks-demo
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
# outputs
|
||||
locals {
|
||||
kubeconfig = <<KUBECONFIG
|
||||
|
||||
|
||||
apiVersion: v1
|
||||
clusters:
|
||||
- cluster:
|
||||
server: ${aws_eks_cluster.demo.endpoint}
|
||||
certificate-authority-data: ${aws_eks_cluster.demo.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: heptio-authenticator-aws
|
||||
args:
|
||||
- "token"
|
||||
- "-i"
|
||||
- "${var.cluster-name}"
|
||||
KUBECONFIG
|
||||
}
|
||||
|
||||
output "kubeconfig" {
|
||||
value = "${local.kubeconfig}"
|
||||
}
|
||||
|
||||
# Join configuration
|
||||
|
||||
locals {
|
||||
config-map-aws-auth = <<CONFIGMAPAWSAUTH
|
||||
|
||||
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: aws-auth
|
||||
namespace: kube-system
|
||||
data:
|
||||
mapRoles: |
|
||||
- rolearn: ${aws_iam_role.demo-node.arn}
|
||||
username: system:node:{{EC2PrivateDNSName}}
|
||||
groups:
|
||||
- system:bootstrappers
|
||||
- system:nodes
|
||||
CONFIGMAPAWSAUTH
|
||||
}
|
||||
|
||||
output "config-map-aws-auth" {
|
||||
value = "${local.config-map-aws-auth}"
|
||||
}
|
||||
Reference in New Issue
Block a user