From 58f150d3721a15fc523b24abbe766d2badf8eeb8 Mon Sep 17 00:00:00 2001 From: ADOT Patch workflow Date: Thu, 11 Jan 2024 15:07:05 -0800 Subject: [PATCH 1/2] Change terraform to use minimal ami --- testing/terraform/ec2/main.tf | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/testing/terraform/ec2/main.tf b/testing/terraform/ec2/main.tf index a5efa41dea..d80c577f55 100644 --- a/testing/terraform/ec2/main.tf +++ b/testing/terraform/ec2/main.tf @@ -27,8 +27,16 @@ locals { } data "aws_ami" "ami" { - executable_users = ["self"] + owners = ["amazon"] most_recent = true + filter { + name = "name" + values = ["al20*-ami-minimal-*-x86_64"] + } + filter { + name = "state" + values = ["available"] + } filter { name = "architecture" values = ["x86_64"] @@ -81,8 +89,10 @@ resource "null_resource" "main_service_setup" { provisioner "remote-exec" { inline = [ - # Install Java 11 and tmux - "yes | sudo amazon-linux-extras install java-openjdk11", + # Install wget + "yes | sudo yum install wget", + # Install Java 11 + "sudo yum install java-11-amazon-corretto -y", # Copy in CW Agent configuration "agent_config='${replace(replace(file("./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}'", @@ -142,8 +152,10 @@ resource "null_resource" "remote_service_setup" { provisioner "remote-exec" { inline = [ - # Install Java 11 and tmux - "yes | sudo amazon-linux-extras install java-openjdk11", + # Install wget + "yes | sudo yum install wget", + # Install Java 11 + "sudo yum install java-11-amazon-corretto -y", # Copy in CW Agent configuration "agent_config='${replace(replace(file("./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}'", From b8a2def7367804eeb568485529765e6ef3a66de2 Mon Sep 17 00:00:00 2001 From: ADOT Patch workflow Date: Thu, 11 Jan 2024 15:25:38 -0800 Subject: [PATCH 2/2] Combine wget and java11 installation --- testing/terraform/ec2/main.tf | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/testing/terraform/ec2/main.tf b/testing/terraform/ec2/main.tf index d80c577f55..cccd0ad4cc 100644 --- a/testing/terraform/ec2/main.tf +++ b/testing/terraform/ec2/main.tf @@ -89,10 +89,8 @@ resource "null_resource" "main_service_setup" { provisioner "remote-exec" { inline = [ - # Install wget - "yes | sudo yum install wget", - # Install Java 11 - "sudo yum install java-11-amazon-corretto -y", + # Install Java 11 and wget + "sudo yum install wget java-11-amazon-corretto -y", # Copy in CW Agent configuration "agent_config='${replace(replace(file("./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}'", @@ -152,10 +150,8 @@ resource "null_resource" "remote_service_setup" { provisioner "remote-exec" { inline = [ - # Install wget - "yes | sudo yum install wget", - # Install Java 11 - "sudo yum install java-11-amazon-corretto -y", + # Install Java 11 and wget + "sudo yum install wget java-11-amazon-corretto -y", # Copy in CW Agent configuration "agent_config='${replace(replace(file("./amazon-cloudwatch-agent.json"), "/\\s+/", ""), "$REGION", var.aws_region)}'",