mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-03-23 09:51:04 +01:00
fix: Correct variable types to improve dynamic check correctness (#2133)
This commit is contained in:
@@ -94,7 +94,7 @@ resource "aws_launch_template" "this" {
|
||||
}
|
||||
|
||||
dynamic "capacity_reservation_specification" {
|
||||
for_each = var.capacity_reservation_specification != null ? [var.capacity_reservation_specification] : []
|
||||
for_each = length(var.capacity_reservation_specification) > 0 ? [var.capacity_reservation_specification] : []
|
||||
content {
|
||||
capacity_reservation_preference = lookup(capacity_reservation_specification.value, "capacity_reservation_preference", null)
|
||||
|
||||
@@ -108,7 +108,7 @@ resource "aws_launch_template" "this" {
|
||||
}
|
||||
|
||||
dynamic "cpu_options" {
|
||||
for_each = var.cpu_options != null ? [var.cpu_options] : []
|
||||
for_each = length(var.cpu_options) > 0 ? [var.cpu_options] : []
|
||||
content {
|
||||
core_count = cpu_options.value.core_count
|
||||
threads_per_core = cpu_options.value.threads_per_core
|
||||
@@ -116,35 +116,35 @@ resource "aws_launch_template" "this" {
|
||||
}
|
||||
|
||||
dynamic "credit_specification" {
|
||||
for_each = var.credit_specification != null ? [var.credit_specification] : []
|
||||
for_each = length(var.credit_specification) > 0 ? [var.credit_specification] : []
|
||||
content {
|
||||
cpu_credits = credit_specification.value.cpu_credits
|
||||
}
|
||||
}
|
||||
|
||||
dynamic "elastic_gpu_specifications" {
|
||||
for_each = var.elastic_gpu_specifications != null ? [var.elastic_gpu_specifications] : []
|
||||
for_each = length(var.elastic_gpu_specifications) > 0 ? [var.elastic_gpu_specifications] : []
|
||||
content {
|
||||
type = elastic_gpu_specifications.value.type
|
||||
}
|
||||
}
|
||||
|
||||
dynamic "elastic_inference_accelerator" {
|
||||
for_each = var.elastic_inference_accelerator != null ? [var.elastic_inference_accelerator] : []
|
||||
for_each = length(var.elastic_inference_accelerator) > 0 ? [var.elastic_inference_accelerator] : []
|
||||
content {
|
||||
type = elastic_inference_accelerator.value.type
|
||||
}
|
||||
}
|
||||
|
||||
dynamic "enclave_options" {
|
||||
for_each = var.enclave_options != null ? [var.enclave_options] : []
|
||||
for_each = length(var.enclave_options) > 0 ? [var.enclave_options] : []
|
||||
content {
|
||||
enabled = enclave_options.value.enabled
|
||||
}
|
||||
}
|
||||
|
||||
dynamic "hibernation_options" {
|
||||
for_each = var.hibernation_options != null ? [var.hibernation_options] : []
|
||||
for_each = length(var.hibernation_options) > 0 ? [var.hibernation_options] : []
|
||||
content {
|
||||
configured = hibernation_options.value.configured
|
||||
}
|
||||
@@ -155,12 +155,12 @@ resource "aws_launch_template" "this" {
|
||||
}
|
||||
|
||||
dynamic "instance_market_options" {
|
||||
for_each = var.instance_market_options != null ? [var.instance_market_options] : []
|
||||
for_each = length(var.instance_market_options) > 0 ? [var.instance_market_options] : []
|
||||
content {
|
||||
market_type = instance_market_options.value.market_type
|
||||
|
||||
dynamic "spot_options" {
|
||||
for_each = lookup(instance_market_options.value, "spot_options", null) != null ? [instance_market_options.value.spot_options] : []
|
||||
for_each = length(lookup(instance_market_options.value, "spot_options", {})) > 0 ? [instance_market_options.value.spot_options] : []
|
||||
content {
|
||||
block_duration_minutes = lookup(spot_options.value, "block_duration_minutes", null)
|
||||
instance_interruption_behavior = lookup(spot_options.value, "instance_interruption_behavior", null)
|
||||
@@ -173,14 +173,14 @@ resource "aws_launch_template" "this" {
|
||||
}
|
||||
|
||||
dynamic "license_specification" {
|
||||
for_each = var.license_specifications != null ? [var.license_specifications] : []
|
||||
for_each = length(var.license_specifications) > 0 ? [var.license_specifications] : []
|
||||
content {
|
||||
license_configuration_arn = license_specifications.value.license_configuration_arn
|
||||
}
|
||||
}
|
||||
|
||||
dynamic "metadata_options" {
|
||||
for_each = var.metadata_options != null ? [var.metadata_options] : []
|
||||
for_each = length(var.metadata_options) > 0 ? [var.metadata_options] : []
|
||||
content {
|
||||
http_endpoint = lookup(metadata_options.value, "http_endpoint", null)
|
||||
http_tokens = lookup(metadata_options.value, "http_tokens", null)
|
||||
@@ -218,7 +218,7 @@ resource "aws_launch_template" "this" {
|
||||
}
|
||||
|
||||
dynamic "placement" {
|
||||
for_each = var.placement != null ? [var.placement] : []
|
||||
for_each = length(var.placement) > 0 ? [var.placement] : []
|
||||
content {
|
||||
affinity = lookup(placement.value, "affinity", null)
|
||||
availability_zone = lookup(placement.value, "availability_zone", null)
|
||||
@@ -318,13 +318,13 @@ resource "aws_autoscaling_group" "this" {
|
||||
}
|
||||
|
||||
dynamic "instance_refresh" {
|
||||
for_each = var.instance_refresh != null ? [var.instance_refresh] : []
|
||||
for_each = length(var.instance_refresh) > 0 ? [var.instance_refresh] : []
|
||||
content {
|
||||
strategy = instance_refresh.value.strategy
|
||||
triggers = lookup(instance_refresh.value, "triggers", null)
|
||||
|
||||
dynamic "preferences" {
|
||||
for_each = lookup(instance_refresh.value, "preferences", null) != null ? [instance_refresh.value.preferences] : []
|
||||
for_each = length(lookup(instance_refresh.value, "preferences", {})) > 0 ? [instance_refresh.value.preferences] : []
|
||||
content {
|
||||
instance_warmup = lookup(preferences.value, "instance_warmup", null)
|
||||
min_healthy_percentage = lookup(preferences.value, "min_healthy_percentage", null)
|
||||
@@ -363,7 +363,7 @@ resource "aws_autoscaling_group" "this" {
|
||||
weighted_capacity = lookup(override.value, "weighted_capacity", null)
|
||||
|
||||
dynamic "launch_template_specification" {
|
||||
for_each = lookup(override.value, "launch_template_specification", null) != null ? override.value.launch_template_specification : []
|
||||
for_each = length(lookup(override.value, "launch_template_specification", {})) > 0 ? override.value.launch_template_specification : []
|
||||
content {
|
||||
launch_template_id = lookup(launch_template_specification.value, "launch_template_id", null)
|
||||
}
|
||||
@@ -375,7 +375,7 @@ resource "aws_autoscaling_group" "this" {
|
||||
}
|
||||
|
||||
dynamic "warm_pool" {
|
||||
for_each = var.warm_pool != null ? [var.warm_pool] : []
|
||||
for_each = length(var.warm_pool) > 0 ? [var.warm_pool] : []
|
||||
content {
|
||||
pool_state = lookup(warm_pool.value, "pool_state", null)
|
||||
min_size = lookup(warm_pool.value, "min_size", null)
|
||||
|
||||
Reference in New Issue
Block a user