Skip to content

add the option to enable Instance Metadata Service Version 2 in worke… #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions modules/worker_groups/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ locals {
spot_allocation_strategy = "lowest-price" # Valid options are 'lowest-price' and 'capacity-optimized'. If 'lowest-price', the Auto Scaling group launches instances using the Spot pools with the lowest price, and evenly allocates your instances across the number of Spot pools. If 'capacity-optimized', the Auto Scaling group launches instances using Spot pools that are optimally chosen based on the available Spot capacity.
spot_instance_pools = 10 # "Number of Spot pools per availability zone to allocate capacity. EC2 Auto Scaling selects the cheapest Spot pools and evenly allocates Spot capacity across the number of Spot pools that you specify."
spot_max_price = "" # Maximum price per unit hour that the user is willing to pay for the Spot instances. Default is the on-demand price
http_endpoint = "disabled" # Whether the metadata service is available
http_tokens = "optional" # Whether or not the metadata service requires session tokens
http_put_response_hop_limit = 1 # The desired HTTP PUT response hop limit for instance metadata requests
instance_metadata_tags = "disabled" # Enables or disables access to instance tags from the instance metadata service
}

# Merge defaults and per-group values to make code cleaner
Expand Down
7 changes: 6 additions & 1 deletion modules/worker_groups/worker_groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,12 @@ resource "aws_launch_template" "worker_groups" {
)
}
}

metadata_options {
http_endpoint = each.value["http_endpoint"]
http_tokens = each.value["http_tokens"]
http_put_response_hop_limit = each.value["http_put_response_hop_limit"]
instance_metadata_tags = each.value["instance_metadata_tags"]
}
tags = var.tags

lifecycle {
Expand Down