Skip to content

Commit 4f28ecc

Browse files
authored
Adding metadata hop limit (#89)
1 parent dbebae0 commit 4f28ecc

File tree

4 files changed

+71
-4
lines changed

4 files changed

+71
-4
lines changed

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,36 @@ Available targets:
212212
| aws | >= 2.0 |
213213
| null | >= 2.0 |
214214

215+
## Modules
216+
217+
| Name | Source | Version |
218+
|------|--------|---------|
219+
| default_sg | cloudposse/security-group/aws | 0.1.2 |
220+
| this | cloudposse/label/null | 0.24.1 |
221+
222+
## Resources
223+
224+
| Name |
225+
|------|
226+
| [aws_ami](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami) |
227+
| [aws_caller_identity](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) |
228+
| [aws_cloudwatch_metric_alarm](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_metric_alarm) |
229+
| [aws_ebs_volume](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ebs_volume) |
230+
| [aws_eip](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) |
231+
| [aws_iam_instance_profile](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_instance_profile) |
232+
| [aws_iam_instance_profile](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_instance_profile) |
233+
| [aws_iam_policy_document](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) |
234+
| [aws_iam_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) |
235+
| [aws_instance](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance) |
236+
| [aws_network_interface](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/network_interface) |
237+
| [aws_network_interface_attachment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/network_interface_attachment) |
238+
| [aws_partition](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) |
239+
| [aws_region](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) |
240+
| [aws_subnet](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet) |
241+
| [aws_volume_attachment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/volume_attachment) |
242+
| [null_data_source](https://registry.terraform.io/providers/hashicorp/null/latest/docs/data-sources/data_source) |
243+
| [null_resource](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) |
244+
215245
## Inputs
216246

217247
| Name | Description | Type | Default | Required |
@@ -252,6 +282,7 @@ Available targets:
252282
| label\_order | The naming order of the id output and Name tag.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 5 elements, but at least one must be present. | `list(string)` | `null` | no |
253283
| label\_value\_case | The letter case of output label values (also used in `tags` and `id`).<br>Possible values: `lower`, `title`, `upper` and `none` (no transformation).<br>Default value: `lower`. | `string` | `null` | no |
254284
| metadata\_http\_endpoint\_enabled | Whether the metadata service is available | `bool` | `true` | no |
285+
| metadata\_http\_put\_response\_hop\_limit | The desired HTTP PUT response hop limit (between 1 and 64) for instance metadata requests. | `number` | `2` | no |
255286
| metadata\_http\_tokens\_required | Whether or not the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2. | `bool` | `true` | no |
256287
| metric\_name | The name for the alarm's associated metric. Allowed values can be found in https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ec2-metricscollected.html | `string` | `"StatusCheckFailed_Instance"` | no |
257288
| metric\_namespace | The namespace for the alarm's associated metric. Allowed values can be found in https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/aws-namespaces.html | `string` | `"AWS/EC2"` | no |
@@ -298,7 +329,6 @@ Available targets:
298329
| role | Name of AWS IAM Role associated with the instance |
299330
| security\_group\_ids | IDs on the AWS Security Groups associated with the instance |
300331
| ssh\_key\_pair | Name of the SSH key pair provisioned on the instance |
301-
302332
<!-- markdownlint-restore -->
303333

304334

docs/terraform.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,36 @@
1414
| aws | >= 2.0 |
1515
| null | >= 2.0 |
1616

17+
## Modules
18+
19+
| Name | Source | Version |
20+
|------|--------|---------|
21+
| default_sg | cloudposse/security-group/aws | 0.1.2 |
22+
| this | cloudposse/label/null | 0.24.1 |
23+
24+
## Resources
25+
26+
| Name |
27+
|------|
28+
| [aws_ami](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami) |
29+
| [aws_caller_identity](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) |
30+
| [aws_cloudwatch_metric_alarm](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_metric_alarm) |
31+
| [aws_ebs_volume](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ebs_volume) |
32+
| [aws_eip](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) |
33+
| [aws_iam_instance_profile](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_instance_profile) |
34+
| [aws_iam_instance_profile](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_instance_profile) |
35+
| [aws_iam_policy_document](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) |
36+
| [aws_iam_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) |
37+
| [aws_instance](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance) |
38+
| [aws_network_interface](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/network_interface) |
39+
| [aws_network_interface_attachment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/network_interface_attachment) |
40+
| [aws_partition](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) |
41+
| [aws_region](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) |
42+
| [aws_subnet](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet) |
43+
| [aws_volume_attachment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/volume_attachment) |
44+
| [null_data_source](https://registry.terraform.io/providers/hashicorp/null/latest/docs/data-sources/data_source) |
45+
| [null_resource](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) |
46+
1747
## Inputs
1848

1949
| Name | Description | Type | Default | Required |
@@ -54,6 +84,7 @@
5484
| label\_order | The naming order of the id output and Name tag.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 5 elements, but at least one must be present. | `list(string)` | `null` | no |
5585
| label\_value\_case | The letter case of output label values (also used in `tags` and `id`).<br>Possible values: `lower`, `title`, `upper` and `none` (no transformation).<br>Default value: `lower`. | `string` | `null` | no |
5686
| metadata\_http\_endpoint\_enabled | Whether the metadata service is available | `bool` | `true` | no |
87+
| metadata\_http\_put\_response\_hop\_limit | The desired HTTP PUT response hop limit (between 1 and 64) for instance metadata requests. | `number` | `2` | no |
5788
| metadata\_http\_tokens\_required | Whether or not the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2. | `bool` | `true` | no |
5889
| metric\_name | The name for the alarm's associated metric. Allowed values can be found in https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ec2-metricscollected.html | `string` | `"StatusCheckFailed_Instance"` | no |
5990
| metric\_namespace | The namespace for the alarm's associated metric. Allowed values can be found in https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/aws-namespaces.html | `string` | `"AWS/EC2"` | no |
@@ -100,5 +131,4 @@
100131
| role | Name of AWS IAM Role associated with the instance |
101132
| security\_group\_ids | IDs on the AWS Security Groups associated with the instance |
102133
| ssh\_key\_pair | Name of the SSH key pair provisioned on the instance |
103-
104134
<!-- markdownlint-restore -->

main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ resource "aws_instance" "default" {
135135
}
136136

137137
metadata_options {
138-
http_endpoint = var.metadata_http_endpoint_enabled ? "enabled" : "disabled"
139-
http_tokens = var.metadata_http_tokens_required ? "required" : "optional"
138+
http_endpoint = var.metadata_http_endpoint_enabled ? "enabled" : "disabled"
139+
http_put_response_hop_limit = var.metadata_http_put_response_hop_limit
140+
http_tokens = var.metadata_http_tokens_required ? "required" : "optional"
140141
}
141142

142143
tags = module.this.tags

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,12 @@ variable "metadata_http_endpoint_enabled" {
283283
description = "Whether the metadata service is available"
284284
}
285285

286+
variable "metadata_http_put_response_hop_limit" {
287+
type = number
288+
default = 2
289+
description = "The desired HTTP PUT response hop limit (between 1 and 64) for instance metadata requests."
290+
}
291+
286292
variable "kms_key_id" {
287293
type = string
288294
default = null

0 commit comments

Comments
 (0)