diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index b577da7..06efda4 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
- rev: v1.90.0
+ rev: v1.91.0
hooks:
- id: terraform_fmt
- id: terraform_docs
diff --git a/modules/self-managed-node-group/README.md b/modules/self-managed-node-group/README.md
index 1c025d5..5fb9cd3 100644
--- a/modules/self-managed-node-group/README.md
+++ b/modules/self-managed-node-group/README.md
@@ -165,7 +165,7 @@ module "self_managed_node_group" {
| [network\_interfaces](#input\_network\_interfaces) | Customize network interfaces to be attached at instance boot time | `list(any)` | `[]` | no |
| [placement](#input\_placement) | The placement of the instance | `map(string)` | `{}` | no |
| [placement\_group](#input\_placement\_group) | The name of the placement group into which you'll launch your instances, if any | `string` | `null` | no |
-| [platform](#input\_platform) | [DEPRECATED - use `ami_type` instead. Will be removed in `v21.0`] Identifies the OS platform as `bottlerocket`, `linux` (AL2), `al2023`, or `windows` | `string` | `"linux"` | no |
+| [platform](#input\_platform) | [DEPRECATED - must use `ami_type` instead. Will be removed in `v21.0`] | `string` | `null` | no |
| [post\_bootstrap\_user\_data](#input\_post\_bootstrap\_user\_data) | User data that is appended to the user data script after of the EKS bootstrap script. Not used when `ami_type` = `BOTTLEROCKET_*` | `string` | `""` | no |
| [pre\_bootstrap\_user\_data](#input\_pre\_bootstrap\_user\_data) | User data that is injected into the user data script ahead of the EKS bootstrap script. Not used when `ami_type` = `BOTTLEROCKET_*` | `string` | `""` | no |
| [private\_dns\_name\_options](#input\_private\_dns\_name\_options) | The options for the instance hostname. The default values are inherited from the subnet | `map(string)` | `{}` | no |
diff --git a/modules/self-managed-node-group/main.tf b/modules/self-managed-node-group/main.tf
index 94844c7..e980453 100644
--- a/modules/self-managed-node-group/main.tf
+++ b/modules/self-managed-node-group/main.tf
@@ -25,9 +25,8 @@ locals {
AL2023_x86_64_STANDARD = "al2023"
AL2023_ARM_64_STANDARD = "al2023"
}
- # Try to use `ami_type` first, but fall back to current, default behavior
- # TODO - will be removed in v21.0
- user_data_type = try(local.ami_type_to_user_data_type[var.ami_type], var.platform)
+
+ user_data_type = local.ami_type_to_user_data_type[var.ami_type]
# Map the AMI type to the respective SSM param path
ami_type_to_ssm_param = {
diff --git a/modules/self-managed-node-group/variables.tf b/modules/self-managed-node-group/variables.tf
index f3b264b..aea1269 100644
--- a/modules/self-managed-node-group/variables.tf
+++ b/modules/self-managed-node-group/variables.tf
@@ -10,10 +10,16 @@ variable "tags" {
default = {}
}
+# tflint-ignore: terraform_unused_declarations
variable "platform" {
- description = "[DEPRECATED - use `ami_type` instead. Will be removed in `v21.0`] Identifies the OS platform as `bottlerocket`, `linux` (AL2), `al2023`, or `windows`"
+ description = "[DEPRECATED - must use `ami_type` instead. Will be removed in `v21.0`]"
type = string
- default = "linux"
+ default = null
+
+ validation {
+ condition = var.platform == null
+ error_message = "`platform` is no longer valid due to the number of OS choices. Please provide an [`ami_type`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-nodegroup.html#cfn-eks-nodegroup-amitype) instead."
+ }
}
################################################################################
diff --git a/node_groups.tf b/node_groups.tf
index 74a5c56..7228931 100644
--- a/node_groups.tf
+++ b/node_groups.tf
@@ -465,7 +465,7 @@ module "self_managed_node_group" {
autoscaling_group_tags = try(each.value.autoscaling_group_tags, var.self_managed_node_group_defaults.autoscaling_group_tags, {})
# User data
- platform = try(each.value.platform, var.self_managed_node_group_defaults.platform, "linux")
+ platform = try(each.value.platform, var.self_managed_node_group_defaults.platform, null)
# TODO - update this when `var.platform` is removed in v21.0
ami_type = try(each.value.ami_type, var.self_managed_node_group_defaults.ami_type, "AL2_x86_64")
cluster_endpoint = try(time_sleep.this[0].triggers["cluster_endpoint"], "")