From 5cf1becd2dc842e25dba5d65e13d2070cba2fdf3 Mon Sep 17 00:00:00 2001 From: Dmitry Borisov Date: Sat, 2 Dec 2023 00:33:08 +0300 Subject: [PATCH] CORE-634 ubuntu-version-not-found-terraform-aws-ec-2-openvpn-connector --- data.tf | 11 +++-------- main.tf | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/data.tf b/data.tf index b0da2c3..dc0b84d 100644 --- a/data.tf +++ b/data.tf @@ -10,17 +10,12 @@ data "template_file" "ec2_user_data" { } } -data "aws_ami" "ubuntu_20_04" { +data "aws_ami" "ubuntu_22_04" { most_recent = true filter { name = "name" - # Ubuntu 20.04 LTS amd64 image in us-east-1. If upgrade is needed, you would need to re-connect to openvpn. - values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-20211118"] - - } - filter { - name = "virtualization-type" - values = ["hvm"] + # Ubuntu 22.04 LTS amd64 image in us-east-1. If upgrade is needed, you would need to re-connect to openvpn. + values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-20230601"] } owners = ["099720109477"] # Canonical } diff --git a/main.tf b/main.tf index 8ba7d10..7083e7d 100644 --- a/main.tf +++ b/main.tf @@ -33,7 +33,7 @@ resource "aws_security_group" "this" { # EC2 resource "aws_instance" "this" { - ami = join("", data.aws_ami.ubuntu_20_04.*.id) + ami = join("", data.aws_ami.ubuntu_22_04.*.id) instance_type = var.instance_type iam_instance_profile = aws_iam_instance_profile.this.name subnet_id = var.private_subnets[0]