mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-01-17 09:07:20 +01:00
feat: Require users to supply OS via ami_type and not via platform which is unable to distinquish between the number of variants supported today (#3068)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/antonbabenko/pre-commit-terraform
|
- repo: https://github.com/antonbabenko/pre-commit-terraform
|
||||||
rev: v1.90.0
|
rev: v1.91.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: terraform_fmt
|
- id: terraform_fmt
|
||||||
- id: terraform_docs
|
- id: terraform_docs
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ module "self_managed_node_group" {
|
|||||||
| <a name="input_network_interfaces"></a> [network\_interfaces](#input\_network\_interfaces) | Customize network interfaces to be attached at instance boot time | `list(any)` | `[]` | no |
|
| <a name="input_network_interfaces"></a> [network\_interfaces](#input\_network\_interfaces) | Customize network interfaces to be attached at instance boot time | `list(any)` | `[]` | no |
|
||||||
| <a name="input_placement"></a> [placement](#input\_placement) | The placement of the instance | `map(string)` | `{}` | no |
|
| <a name="input_placement"></a> [placement](#input\_placement) | The placement of the instance | `map(string)` | `{}` | no |
|
||||||
| <a name="input_placement_group"></a> [placement\_group](#input\_placement\_group) | The name of the placement group into which you'll launch your instances, if any | `string` | `null` | no |
|
| <a name="input_placement_group"></a> [placement\_group](#input\_placement\_group) | The name of the placement group into which you'll launch your instances, if any | `string` | `null` | no |
|
||||||
| <a name="input_platform"></a> [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 |
|
| <a name="input_platform"></a> [platform](#input\_platform) | [DEPRECATED - must use `ami_type` instead. Will be removed in `v21.0`] | `string` | `null` | no |
|
||||||
| <a name="input_post_bootstrap_user_data"></a> [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 |
|
| <a name="input_post_bootstrap_user_data"></a> [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 |
|
||||||
| <a name="input_pre_bootstrap_user_data"></a> [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 |
|
| <a name="input_pre_bootstrap_user_data"></a> [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 |
|
||||||
| <a name="input_private_dns_name_options"></a> [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 |
|
| <a name="input_private_dns_name_options"></a> [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 |
|
||||||
|
|||||||
@@ -25,9 +25,8 @@ locals {
|
|||||||
AL2023_x86_64_STANDARD = "al2023"
|
AL2023_x86_64_STANDARD = "al2023"
|
||||||
AL2023_ARM_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 = local.ami_type_to_user_data_type[var.ami_type]
|
||||||
user_data_type = try(local.ami_type_to_user_data_type[var.ami_type], var.platform)
|
|
||||||
|
|
||||||
# Map the AMI type to the respective SSM param path
|
# Map the AMI type to the respective SSM param path
|
||||||
ami_type_to_ssm_param = {
|
ami_type_to_ssm_param = {
|
||||||
|
|||||||
@@ -10,10 +10,16 @@ variable "tags" {
|
|||||||
default = {}
|
default = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# tflint-ignore: terraform_unused_declarations
|
||||||
variable "platform" {
|
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
|
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."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|||||||
@@ -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, {})
|
autoscaling_group_tags = try(each.value.autoscaling_group_tags, var.self_managed_node_group_defaults.autoscaling_group_tags, {})
|
||||||
|
|
||||||
# User data
|
# 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
|
# 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")
|
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"], "")
|
cluster_endpoint = try(time_sleep.this[0].triggers["cluster_endpoint"], "")
|
||||||
|
|||||||
Reference in New Issue
Block a user