Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a1691a0

Browse files
fix: Fixed ami variable when using without ssm (#354)
1 parent 2dc3446 commit a1691a0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

‎main.tf‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ locals {
44
create = var.create && var.putin_khuylo
55

66
is_t_instance_type = replace(var.instance_type, "/^t(2|3|3a|4g){1}\\..*$/", "1") == "1" ? true : false
7+
8+
ami = try(coalesce(var.ami, try(nonsensitive(data.aws_ssm_parameter.this[0].value), null)), null)
79
}
810

911
data "aws_ssm_parameter" "this" {
@@ -19,7 +21,7 @@ data "aws_ssm_parameter" "this" {
1921
resource "aws_instance" "this" {
2022
count = local.create && !var.ignore_ami_changes && !var.create_spot_instance ? 1 : 0
2123

22-
ami = try(coalesce(var.ami, nonsensitive(data.aws_ssm_parameter.this[0].value)), null)
24+
ami = local.ami
2325
instance_type = var.instance_type
2426
cpu_core_count = var.cpu_core_count
2527
cpu_threads_per_core = var.cpu_threads_per_core
@@ -187,7 +189,7 @@ resource "aws_instance" "this" {
187189
resource "aws_instance" "ignore_ami" {
188190
count = local.create && var.ignore_ami_changes && !var.create_spot_instance ? 1 : 0
189191

190-
ami = try(coalesce(var.ami, nonsensitive(data.aws_ssm_parameter.this[0].value)), null)
192+
ami = local.ami
191193
instance_type = var.instance_type
192194
cpu_core_count = var.cpu_core_count
193195
cpu_threads_per_core = var.cpu_threads_per_core
@@ -361,7 +363,7 @@ resource "aws_instance" "ignore_ami" {
361363
resource "aws_spot_instance_request" "this" {
362364
count = local.create && var.create_spot_instance ? 1 : 0
363365

364-
ami = try(coalesce(var.ami, nonsensitive(data.aws_ssm_parameter.this[0].value)), null)
366+
ami = local.ami
365367
instance_type = var.instance_type
366368
cpu_core_count = var.cpu_core_count
367369
cpu_threads_per_core = var.cpu_threads_per_core

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /