From 5398fec8a294e94e528d5f2d81998fbfb65b323c Mon Sep 17 00:00:00 2001 From: lilyeyes Date: Wed, 23 Aug 2023 18:55:19 +0800 Subject: [PATCH] Deploy valid AWS images past their DeprecationTime TEAM-8177 - [AWS][Terraform] qe-sap-deployment cannot deploy valid images past their DeprecationTime --- terraform/aws/modules/get_os_image/main.tf | 10 ++++++++-- terraform/aws/version.tf | 4 ++-- terraform/gcp/variables.tf | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/terraform/aws/modules/get_os_image/main.tf b/terraform/aws/modules/get_os_image/main.tf index 5f5637b3..b33d1a5a 100644 --- a/terraform/aws/modules/get_os_image/main.tf +++ b/terraform/aws/modules/get_os_image/main.tf @@ -1,7 +1,8 @@ # Data used to get the correct AMI image data "aws_ami" "image" { - most_recent = true - owners = [var.os_owner] + most_recent = true + owners = [var.os_owner] + include_deprecated = true filter { name = "name" @@ -22,4 +23,9 @@ data "aws_ami" "image" { name = "virtualization-type" values = ["hvm"] } + + filter { + name = "state" + values = ["available"] + } } diff --git a/terraform/aws/version.tf b/terraform/aws/version.tf index 6be93e84..811d38f4 100644 --- a/terraform/aws/version.tf +++ b/terraform/aws/version.tf @@ -4,11 +4,11 @@ terraform { # Configure the Azure Provider aws = { source = "hashicorp/aws" - version = "~> 4.0.0" + #version = "~> 5.13.1" } null = { source = "hashicorp/null" - version = "~> 3.1.0" + version = "~> 3.2.1" } } } diff --git a/terraform/gcp/variables.tf b/terraform/gcp/variables.tf index 1059dd2d..071a37a2 100644 --- a/terraform/gcp/variables.tf +++ b/terraform/gcp/variables.tf @@ -81,7 +81,7 @@ variable "deployment_name" { default = "" validation { condition = ( - var.deployment_name != "default" && var.deployment_name != "" + var.deployment_name != "default" ) error_message = "Invalid deployment_name (default) ." }