mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-04-27 10:57:25 +02:00
Use kubernetes provider to manage aws auth (#355)
This commit changes the way aws auth is managed. Before a local file was used the generate the template and a null resource to apply it. This is now switched to the terraform kubernetes provider.
This commit is contained in:
committed by
Max Williams
parent
b69c8fb759
commit
9363662574
22
README.md
22
README.md
@@ -18,9 +18,29 @@ Read the [AWS docs on EKS to get connected to the k8s dashboard](https://docs.aw
|
||||
|
||||
## Usage example
|
||||
|
||||
A full example leveraging other community modules is contained in the [examples/basic directory](https://github.com/terraform-aws-modules/terraform-aws-eks/tree/master/examples/basic). Here's the gist of using it via the Terraform registry:
|
||||
A full example leveraging other community modules is contained in the [examples/basic directory](https://github.com/terraform-aws-modules/terraform-aws-eks/tree/master/examples/basic).
|
||||
Please do not forget to set the provider to the EKS cluster. This is needed to provision the aws_auth configmap in
|
||||
kube-system. You can also use this provider to create your own kubernetes resources with the terraform kubernetes
|
||||
provider.
|
||||
Here's the gist of using it via the Terraform registry:
|
||||
|
||||
```hcl
|
||||
data "aws_eks_cluster" "cluster" {
|
||||
name = module.eks.cluster_id
|
||||
}
|
||||
|
||||
data "aws_eks_cluster_auth" "cluster" {
|
||||
name = module.eks.cluster_id
|
||||
}
|
||||
|
||||
provider "kubernetes" {
|
||||
host = data.aws_eks_cluster.cluster.endpoint
|
||||
cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
|
||||
token = data.aws_eks_cluster_auth.cluster.token
|
||||
load_config_file = false
|
||||
version = "~> 1.9"
|
||||
}
|
||||
|
||||
module "my-cluster" {
|
||||
source = "terraform-aws-modules/eks/aws"
|
||||
cluster_name = "my-cluster"
|
||||
|
||||
Reference in New Issue
Block a user