mirror of
https://github.com/farcasclaudiu/terraform-course.git
synced 2026-06-22 05:01:55 +03:00
5d9eeb6c4c
* Terraform 0.12
64 lines
1.0 KiB
Terraform
64 lines
1.0 KiB
Terraform
# 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
|
|
}
|
|
|