Skip to content

Commit

Permalink
Change terraform to use minimal ami (aws-observability#712)
Browse files Browse the repository at this point in the history
* Change terraform to use minimal ami

* Combine wget and java11 installation

---------

Co-authored-by: ADOT Patch workflow <adot-patch-workflow@github.com>
  • Loading branch information
2 people authored and vasireddy99 committed Feb 23, 2024
1 parent af4d498 commit 018d1ab
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions testing/terraform/ec2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -81,8 +89,8 @@ resource "null_resource" "main_service_setup" {

provisioner "remote-exec" {
inline = [
# Install Java 11 and tmux
"yes | sudo amazon-linux-extras install java-openjdk11",
# 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)}'",
Expand Down Expand Up @@ -142,8 +150,8 @@ resource "null_resource" "remote_service_setup" {

provisioner "remote-exec" {
inline = [
# Install Java 11 and tmux
"yes | sudo amazon-linux-extras install java-openjdk11",
# 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)}'",
Expand Down

0 comments on commit 018d1ab

Please sign in to comment.