mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-05-01 12:54:29 +02:00
feat!: Replace the use of aws-auth configmap with EKS cluster access entry (#2858)
* feat: Replace `resolve_conflicts` with `resolve_conflicts_on_create`/`delete`; raise MSV of AWS provider to `v5.0` to support * fix: Replace dynamic DNS suffix for `sts:AssumeRole` API calls for static suffix * feat: Add module tag * feat: Align Karpenter permissions with Karpenter v1beta1/v0.32 permissions from upstream * refactor: Move `aws-auth` ConfigMap functionality to its own sub-module * chore: Update examples * feat: Add state `moved` block for Karpenter Pod Identity role re-name * fix: Correct variable `create` description * feat: Add support for cluster access entries * chore: Bump MSV of Terraform to `1.3` * fix: Replace defunct kubectl provider with an updated forked equivalent * chore: Update and validate examples for access entry; clean up provider usage * docs: Correct double redundant variable descriptions * feat: Add support for Cloudwatch log group class argument * fix: Update usage tag placement, fix Karpenter event spelling, add upcoming changes section to upgrade guide * feat: Update Karpenter module to generalize naming used and align policy with the upstream Karpenter policy * feat: Add native support for Windows based managed nodegroups similar to AL2 and Bottlerocket * feat: Update self-managed nodegroup module to use latest features of ASG * docs: Update and simplify docs * fix: Correct variable description for AMI types * fix: Update upgrade guide with changes; rename Karpenter controller resource names to support migrating for users * docs: Complete upgrade guide docs for migration and changes applied * Update examples/karpenter/README.md Co-authored-by: Anton Babenko <anton@antonbabenko.com> * Update examples/outposts/README.md Co-authored-by: Anton Babenko <anton@antonbabenko.com> * Update modules/karpenter/README.md Co-authored-by: Anton Babenko <anton@antonbabenko.com> --------- Co-authored-by: Anton Babenko <anton@antonbabenko.com>
This commit is contained in:
81
modules/aws-auth/README.md
Normal file
81
modules/aws-auth/README.md
Normal file
@@ -0,0 +1,81 @@
|
||||
# `aws-auth` Module
|
||||
|
||||
Configuration in this directory creates/updates the `aws-auth` ConfigMap.
|
||||
|
||||
```hcl
|
||||
module "eks" {
|
||||
source = "terraform-aws-modules/eks/aws//modules/aws-auth"
|
||||
version = "~> 20.0"
|
||||
|
||||
manage_aws_auth_configmap = true
|
||||
|
||||
aws_auth_roles = [
|
||||
{
|
||||
rolearn = "arn:aws:iam::66666666666:role/role1"
|
||||
username = "role1"
|
||||
groups = ["system:masters"]
|
||||
},
|
||||
]
|
||||
|
||||
aws_auth_users = [
|
||||
{
|
||||
userarn = "arn:aws:iam::66666666666:user/user1"
|
||||
username = "user1"
|
||||
groups = ["system:masters"]
|
||||
},
|
||||
{
|
||||
userarn = "arn:aws:iam::66666666666:user/user2"
|
||||
username = "user2"
|
||||
groups = ["system:masters"]
|
||||
},
|
||||
]
|
||||
|
||||
aws_auth_accounts = [
|
||||
"777777777777",
|
||||
"888888888888",
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
|
||||
## Requirements
|
||||
|
||||
| Name | Version |
|
||||
|------|---------|
|
||||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
|
||||
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 2.20 |
|
||||
|
||||
## Providers
|
||||
|
||||
| Name | Version |
|
||||
|------|---------|
|
||||
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | >= 2.20 |
|
||||
|
||||
## Modules
|
||||
|
||||
No modules.
|
||||
|
||||
## Resources
|
||||
|
||||
| Name | Type |
|
||||
|------|------|
|
||||
| [kubernetes_config_map.aws_auth](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/config_map) | resource |
|
||||
| [kubernetes_config_map_v1_data.aws_auth](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/config_map_v1_data) | resource |
|
||||
|
||||
## Inputs
|
||||
|
||||
| Name | Description | Type | Default | Required |
|
||||
|------|-------------|------|---------|:--------:|
|
||||
| <a name="input_aws_auth_accounts"></a> [aws\_auth\_accounts](#input\_aws\_auth\_accounts) | List of account maps to add to the aws-auth configmap | `list(any)` | `[]` | no |
|
||||
| <a name="input_aws_auth_roles"></a> [aws\_auth\_roles](#input\_aws\_auth\_roles) | List of role maps to add to the aws-auth configmap | `list(any)` | `[]` | no |
|
||||
| <a name="input_aws_auth_users"></a> [aws\_auth\_users](#input\_aws\_auth\_users) | List of user maps to add to the aws-auth configmap | `list(any)` | `[]` | no |
|
||||
| <a name="input_create"></a> [create](#input\_create) | Controls if resources should be created (affects all resources) | `bool` | `true` | no |
|
||||
| <a name="input_create_aws_auth_configmap"></a> [create\_aws\_auth\_configmap](#input\_create\_aws\_auth\_configmap) | Determines whether to create the aws-auth configmap. NOTE - this is only intended for scenarios where the configmap does not exist (i.e. - when using only self-managed node groups). Most users should use `manage_aws_auth_configmap` | `bool` | `false` | no |
|
||||
| <a name="input_manage_aws_auth_configmap"></a> [manage\_aws\_auth\_configmap](#input\_manage\_aws\_auth\_configmap) | Determines whether to manage the aws-auth configmap | `bool` | `true` | no |
|
||||
|
||||
## Outputs
|
||||
|
||||
No outputs.
|
||||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
|
||||
47
modules/aws-auth/main.tf
Normal file
47
modules/aws-auth/main.tf
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
################################################################################
|
||||
# aws-auth configmap
|
||||
################################################################################
|
||||
|
||||
locals {
|
||||
aws_auth_configmap_data = {
|
||||
mapRoles = yamlencode(var.aws_auth_roles)
|
||||
mapUsers = yamlencode(var.aws_auth_users)
|
||||
mapAccounts = yamlencode(var.aws_auth_accounts)
|
||||
}
|
||||
}
|
||||
|
||||
resource "kubernetes_config_map" "aws_auth" {
|
||||
count = var.create && var.create_aws_auth_configmap ? 1 : 0
|
||||
|
||||
metadata {
|
||||
name = "aws-auth"
|
||||
namespace = "kube-system"
|
||||
}
|
||||
|
||||
data = local.aws_auth_configmap_data
|
||||
|
||||
lifecycle {
|
||||
# We are ignoring the data here since we will manage it with the resource below
|
||||
# This is only intended to be used in scenarios where the configmap does not exist
|
||||
ignore_changes = [data, metadata[0].labels, metadata[0].annotations]
|
||||
}
|
||||
}
|
||||
|
||||
resource "kubernetes_config_map_v1_data" "aws_auth" {
|
||||
count = var.create && var.manage_aws_auth_configmap ? 1 : 0
|
||||
|
||||
force = true
|
||||
|
||||
metadata {
|
||||
name = "aws-auth"
|
||||
namespace = "kube-system"
|
||||
}
|
||||
|
||||
data = local.aws_auth_configmap_data
|
||||
|
||||
depends_on = [
|
||||
# Required for instances where the configmap does not exist yet to avoid race condition
|
||||
kubernetes_config_map.aws_auth,
|
||||
]
|
||||
}
|
||||
0
modules/aws-auth/outputs.tf
Normal file
0
modules/aws-auth/outputs.tf
Normal file
39
modules/aws-auth/variables.tf
Normal file
39
modules/aws-auth/variables.tf
Normal file
@@ -0,0 +1,39 @@
|
||||
variable "create" {
|
||||
description = "Controls if resources should be created (affects all resources)"
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# aws-auth ConfigMap
|
||||
################################################################################
|
||||
|
||||
variable "create_aws_auth_configmap" {
|
||||
description = "Determines whether to create the aws-auth configmap. NOTE - this is only intended for scenarios where the configmap does not exist (i.e. - when using only self-managed node groups). Most users should use `manage_aws_auth_configmap`"
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
|
||||
variable "manage_aws_auth_configmap" {
|
||||
description = "Determines whether to manage the aws-auth configmap"
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
variable "aws_auth_roles" {
|
||||
description = "List of role maps to add to the aws-auth configmap"
|
||||
type = list(any)
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "aws_auth_users" {
|
||||
description = "List of user maps to add to the aws-auth configmap"
|
||||
type = list(any)
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "aws_auth_accounts" {
|
||||
description = "List of account maps to add to the aws-auth configmap"
|
||||
type = list(any)
|
||||
default = []
|
||||
}
|
||||
10
modules/aws-auth/versions.tf
Normal file
10
modules/aws-auth/versions.tf
Normal file
@@ -0,0 +1,10 @@
|
||||
terraform {
|
||||
required_version = ">= 1.3"
|
||||
|
||||
required_providers {
|
||||
kubernetes = {
|
||||
source = "hashicorp/kubernetes"
|
||||
version = ">= 2.20"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user