Skip to content

Commit

Permalink
feat: Add metadata_options for node_groups
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbrunet committed Jul 16, 2021
1 parent 9022013 commit 2862deb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/node_groups/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ The role ARN specified in `var.default_iam_role_arn` will be used by default. In
| subnets | Subnets to contain workers | list(string) | `var.workers_group_defaults[subnets]` |
| version | Kubernetes version | string | Provider default behavior |
| taints | Kubernetes node taints | list(map) | empty |
| metadata_http_endpoint | The state of the instance metadata service. Requires `create_launch_template` to be `true` | bool | `var.workers_group_defaults[metadata_http_endpoint]` |
| metadata_http_tokens | If session tokens are required. Requires `create_launch_template` to be `true` | bool | `var.workers_group_defaults[metadata_http_tokens]` |
| metadata_http_put_response_hop_limit | The desired HTTP PUT response hop limit for instance metadata requests. Requires `create_launch_template` to be `true` | bool | `var.workers_group_defaults[metadata_http_put_response_hop_limit]` |

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
Expand Down
6 changes: 6 additions & 0 deletions modules/node_groups/launch_template.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ resource "aws_launch_template" "workers" {

key_name = lookup(each.value, "key_name", null)

metadata_options {
http_endpoint = lookup(each.value, "metadata_http_endpoint", null)
http_tokens = lookup(each.value, "metadata_http_tokens", null)
http_put_response_hop_limit = lookup(each.value, "metadata_http_put_response_hop_limit", null)
}

# Supplying custom tags to EKS instances is another use-case for LaunchTemplates
tag_specifications {
resource_type = "instance"
Expand Down

0 comments on commit 2862deb

Please sign in to comment.