Skip to content

v21: encryption cannot be turned off with encryption config. #3435

@TheFLHurricane

Description

@TheFLHurricane

Description

encryption_config variable cannot be set to {} to disable encryption. Although {} is the default, the type setting for resources provides a default of ["strings"] which will always override the empty {} even if explicitly set. You can change this by declaring resources = [], however, because the local.enable_encryption_config relies on length(var.encryption_config) > 0, it still considers encryption to be turned on and creates all associated KMS resources.

Versions

  • Module version [Required]: v21.0

  • Terraform version: v1.12.2

  • Provider version(s): v6.4.0

Reproduction Code [Required]

module "eks" {
create = var.create_eks_cluster

source = "terraform-aws-modules/eks/aws"

kubernetes_version = var.eks_cluster_version
name = "${var.cluster}-${var.release_name}-cluster"
vpc_id = var.vpc_id
subnet_ids = flatten(var.subnets)

enable_irsa = true

endpoint_private_access = true
endpoint_public_access = false

create_security_group = false
create_primary_security_group_tags = false
security_group_id = data.aws_security_group.eks_cluster_sg.id
create_node_security_group = false
node_security_group_id = data.aws_security_group.eks_all_workers_sg.id

prefix_separator = ""
iam_role_name = "${var.cluster}-${var.release_name}-cluster"
iam_role_additional_policies = {
AmazonEKSServicePolicy = "arn:aws:iam::aws:policy/AmazonEKSServicePolicy"
}

addons = {
kube-proxy = {
resolve_conflicts_on_create = "OVERWRITE"
}
eks-node-monitoring-agent = {}
}

encryption_config = {}

timeouts = {
create = "30m"
delete = "15m"
update = "60m"
}

enable_cluster_creator_admin_permissions = true

}

Steps to reproduce the behavior:

Set encryption_config to {}

Expected behavior

Not create any resources related to encryption

Actual behavior

All encryption resources are created and encryption added for secrets.

Additional context

Solution is to remove ["secrets"] as default for resources under type and put resources = ["secrets"] into the default for the variable. This will maintain the existing default functionality while allowing users to still optionally flag off the encryption as before.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions