From 7acb479e957997dd311c24ae0056d2ea2629ae88 Mon Sep 17 00:00:00 2001 From: David Sibley Date: Fri, 11 Oct 2024 15:18:39 +0100 Subject: [PATCH] updated template to use dynamic resolution of SSM parameter store value --- main.tf | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/main.tf b/main.tf index 6b1fbfb..cb66a38 100644 --- a/main.tf +++ b/main.tf @@ -379,22 +379,6 @@ resource "aws_iam_instance_profile" "bastion_profile" { } ## Bastion - -data "aws_ami" "linux_2_image" { - most_recent = true - owners = ["amazon"] - - filter { - name = "name" - values = ["amzn2-ami-hvm*"] - } - - filter { - name = "virtualization-type" - values = ["hvm"] - } -} - resource "aws_launch_template" "bastion_linux_template" { name = "${var.instance_name}_template" @@ -413,7 +397,7 @@ resource "aws_launch_template" "bastion_linux_template" { name = aws_iam_instance_profile.bastion_profile.id } - image_id = data.aws_ami.linux_2_image.id + image_id = "resolve:ssm:/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2" instance_initiated_shutdown_behavior = "terminate" instance_type = "t3.micro"