mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-01-16 16:47:20 +01:00
59 lines
1.2 KiB
HCL
59 lines
1.2 KiB
HCL
data "aws_region" "current" {}
|
|
|
|
data "aws_availability_zones" "available" {}
|
|
|
|
provider "http" {}
|
|
|
|
data "http" "workstation-external-ip" {
|
|
url = "http://icanhazip.com"
|
|
}
|
|
|
|
# Override with variable or hardcoded value if necessary
|
|
locals {
|
|
workstation_external_cidr = "${chomp(data.http.workstation-external-ip.body)}/32"
|
|
|
|
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
|
|
|
|
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
|
|
}
|