Skip to content

aws_eks_node_group: Idempotency broken for empty remote_access block #11063

@eytanhanig

Description

@eytanhanig

Note: I am unsure whether this is expected behavior for configuration blocks, however the end result is that you can't conditionally use remote_access and maintain idempotency. If it is expected behavior for configuration blocks then this issue turns into a feature request to have it not be a configuration block.

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

$ terraform -v
Terraform v0.12.16
+ provider.aws v2.40.0

Affected Resource(s)

  • aws_eks_node_group

Terraform Configuration Files

This was discovered while helping with the PR to add Support for EKS Managed Node Groups to the module terraform-aws-modules/terraform-aws-eks. Below is a simplified case:

resource "aws_eks_node_group" "workers" {
  node_group_name = "debug"

  cluster_name    = "test-eks-gC3cDC9O"
  node_role_arn   = "arn:aws:iam::REDACTED:role/test-eks-gC3cDC9O-managed-node-groups"
  subnet_ids      = ["subnet-REDACTED1", "subnet-REDACTED2", "subnet-REDACTED3"]

  scaling_config {
    desired_size = "1"
    max_size     = "1"
    min_size     = "1"
  }

  remote_access {}
}

Debug Output

This produces no errors. terraform plan predicts the following and terraform apply implements it without issue:

      + remote_access { # forces replacement}`

Expected Behavior

  • After the initial apply terraform plan and terraform apply should be idempotent and predict no changes.

Actual Behavior

Idempotency is broken - and therefore subsequent applies attempt to destroy & recreate the node group - when remote_access is used in the following ways:

remote_access {}
remote_access {
  ec2_ssh_key = ""
}
remote_access {
  ec2_ssh_key = null
}

Please note that this issue does not occur when a key is specificied.

Steps to Reproduce

  1. terraform apply --auto-approve
  2. terraform plan

Important Factoids

Despite being present in the list of optional arguments remote_apply is a configuration block and behaves as such. The two arguments that it contains are also both listed as optional.

Regardless of whether this is the expected behavior of configuration blocks - and I suspect it isn't - we need a way to make use conditionals with this functionality. Is it possible to use the same key_name and security_groups arguments that we have for launch_configuration, or is using a configuration block necessitated by the AWS API?

Metadata

Metadata

Assignees

No one assigned

    Labels

    service/eksIssues and PRs that pertain to the eks service.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions