Skip to content

Commit

Permalink
fix: Use cluster_name rather than cluster_endpoint for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
js-timbirkett committed Mar 11, 2020
1 parent fff4f90 commit 19f40b1
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ module "node_groups" {
module "aws_auth" {
source = "./modules/aws_auth"

cluster_endpoint = module.control_plane.cluster_endpoint
map_instances = concat(module.worker_groups.aws_auth_roles, module.node_groups.aws_auth_roles)
cluster_name = module.control_plane.cluster_id
map_instances = concat(module.worker_groups.aws_auth_roles, module.node_groups.aws_auth_roles)

create_eks = var.create_eks
manage_aws_auth = var.manage_aws_auth
Expand Down
3 changes: 2 additions & 1 deletion modules/aws_auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

| Name | Version |
|------|---------|
| aws | >= 2.52.0 |
| kubernetes | >= 1.6.2 |
| null | >= 2.1 |
| template | >= 2.1 |
Expand All @@ -13,7 +14,7 @@

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:-----:|
| cluster\_endpoint | Endpoint for the EKS cluster. | `string` | n/a | yes |
| cluster\_name | Name of the EKS cluster. | `string` | n/a | yes |
| create\_eks | Controls if EKS resources should be created (it affects almost all resources). | `bool` | `true` | no |
| manage\_aws\_auth | Whether to apply the aws-auth configmap file. | `bool` | `true` | no |
| map\_accounts | Additional AWS account numbers to add to the aws-auth configmap. See examples/basic/variables.tf for example format. | `list(string)` | `[]` | no |
Expand Down
6 changes: 5 additions & 1 deletion modules/aws_auth/aws_auth.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ data "template_file" "map_instances" {
vars = var.map_instances[count.index]
}

data "aws_eks_cluster" "this" {
name = var.cluster_name
}

resource "null_resource" "wait_for_cluster" {
count = var.create_eks && var.manage_aws_auth ? 1 : 0

provisioner "local-exec" {
environment = {
ENDPOINT = var.cluster_endpoint
ENDPOINT = data.aws_eks_cluster.this.endpoint
}

command = var.wait_for_cluster_cmd
Expand Down
4 changes: 2 additions & 2 deletions modules/aws_auth/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ variable "create_eks" {
default = true
}

variable "cluster_endpoint" {
description = "Endpoint for the EKS cluster."
variable "cluster_name" {
description = "Name of the EKS cluster."
type = string
}

Expand Down
2 changes: 1 addition & 1 deletion modules/worker_groups/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This submodule is designed for use by both the parent `eks` module and by the us
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:-----:|
| attach\_worker\_cni\_policy | Whether to attach the Amazon managed `AmazonEKS_CNI_Policy` IAM policy to the default worker groups IAM role. WARNING: If set `false` the permissions must be assigned to the `aws-worker` DaemonSet pods via another method or workers will not be able to join the cluster. | `bool` | `true` | no |
| cluster\_name | Name of parent cluster. | `string` | n/a | yes |
| cluster\_name | Name of the parent EKS cluster. | `string` | n/a | yes |
| cluster\_security\_group\_id | If provided, the EKS cluster will be attached to this security group. If not given, a security group will be created with necessary ingress/egress to work with the workers | `string` | n/a | yes |
| create\_eks | Controls if EKS resources should be created (it affects almost all resources). | `bool` | `true` | no |
| iam\_path | If provided, all IAM roles will be created on this path. | `string` | `"/"` | no |
Expand Down
2 changes: 1 addition & 1 deletion modules/worker_groups/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ variable "create_eks" {
}

variable "cluster_name" {
description = "Name of parent cluster."
description = "Name of the parent EKS cluster."
type = string
}

Expand Down

0 comments on commit 19f40b1

Please sign in to comment.