Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.
Merged
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
8 changes: 5 additions & 3 deletions modules/attachment/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ locals {
]
)

validate_profile_name = length(local.sorted_list) == 0 ? tobool("Could not find a valid profile name ${var.profile_name}") : true

# Retrieve profile with the latest version by getting last element in sorted list
latest_profile = local.sorted_list[length(local.sorted_list) - 1]
latest_profile = local.validate_profile_name ? local.sorted_list[length(local.sorted_list) - 1] : null

profile_map = var.profile_version == "latest" ? {
(var.profile_name) = local.latest_profile
Expand All @@ -46,9 +48,9 @@ locals {
}

# tflint-ignore: terraform_unused_declarations
validate_profile = lookup(local.profile_map, var.profile_name, null) == null ? tobool("Could not find a valid profile name ${var.profile_name} and matching version ${var.profile_version}") : true
validate_profile_version = lookup(local.profile_map, var.profile_name, null) == null ? tobool("Could not find a valid profile name ${var.profile_name} and matching version ${var.profile_version}") : true

profile = local.validate_profile ? local.profile_map[var.profile_name] : null
profile = local.validate_profile_version ? local.profile_map[var.profile_name] : null
}

data "ibm_scc_profile" "scc_profile" {
Expand Down