-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Description
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 planandterraform applyshould 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
terraform apply --auto-approveterraform 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?