From 9d3b384ff26b280d076d73fd8608befc8ccb19de Mon Sep 17 00:00:00 2001 From: Mahad Janjua <134644284+majanjua-amzn@users.noreply.github.com> Date: Wed, 29 Nov 2023 09:47:28 -0800 Subject: [PATCH] E2E Test: Ensure the use of IMDSv2 in EC2 instances (#621) --- testing/terraform/ec2/main.tf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/testing/terraform/ec2/main.tf b/testing/terraform/ec2/main.tf index dff44a04b8..bf8c721df7 100644 --- a/testing/terraform/ec2/main.tf +++ b/testing/terraform/ec2/main.tf @@ -34,6 +34,9 @@ resource "aws_instance" "main_service_instance" { vpc_security_group_ids = [aws_default_vpc.default.default_security_group_id] associate_public_ip_address = true instance_initiated_shutdown_behavior = "terminate" + metadata_options { + http_tokens = "required" + } tags = { Name = "main-service-${var.test_id}" @@ -92,6 +95,9 @@ resource "aws_instance" "remote_service_instance" { vpc_security_group_ids = [aws_default_vpc.default.default_security_group_id] associate_public_ip_address = true instance_initiated_shutdown_behavior = "terminate" + metadata_options { + http_tokens = "required" + } tags = { Name = "remote-service-${var.test_id}" @@ -140,4 +146,4 @@ resource "null_resource" "remote_service_setup" { } depends_on = [aws_instance.remote_service_instance] -} \ No newline at end of file +}