Skip to content

Commit

Permalink
fix: Pass in cluster_endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
js-timbirkett committed Mar 11, 2020
1 parent 4a6bfcf commit ae728e4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ module "node_groups" {
module "aws_auth" {
source = "./modules/aws_auth"

map_instances = concat(module.worker_groups.aws_auth_roles, module.node_groups.aws_auth_roles)
cluster_endpoint = module.control_plane.cluster_endpoint
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
2 changes: 1 addition & 1 deletion modules/aws_auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

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

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:-----:|
| cluster\_endpoint | Endpoint for 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: 1 addition & 5 deletions modules/aws_auth/aws_auth.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@ 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 = data.aws_eks_cluster.this.endpoint
ENDPOINT = var.cluster_endpoint
}

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

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

variable "manage_aws_auth" {
description = "Whether to apply the aws-auth configmap file."
default = true
Expand Down

0 comments on commit ae728e4

Please sign in to comment.