Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions modules/self-managed-node-group/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ locals {
}

data "aws_ssm_parameter" "ami" {
count = var.create ? 1 : 0
# only pull the ami if we're creating the resource AND we're not already using a custom ami
count = var.create && length(var.ami_id) == 0 ? 1 : 0

region = var.region

Expand Down Expand Up @@ -219,7 +220,7 @@ resource "aws_launch_template" "this" {
arn = var.create_iam_instance_profile ? aws_iam_instance_profile.this[0].arn : var.iam_instance_profile_arn
}

image_id = coalesce(var.ami_id, nonsensitive(data.aws_ssm_parameter.ami[0].value))
image_id = coalesce(var.ami_id, nonsensitive(try(data.aws_ssm_parameter.ami[0].value, "")))
instance_initiated_shutdown_behavior = var.instance_initiated_shutdown_behavior

dynamic "instance_market_options" {
Expand Down
Loading