-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: #568 Terraform destroy fails when state is empty #1020
fix: #568 Terraform destroy fails when state is empty #1020
Conversation
I am not sure why Lint/Docs is failing. Please let me know what should i do to fix it. |
You need to rebase your branch from master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ageekymonk for your PR. Please can you use splat syntax instead of ternary operation.
@@ -144,10 +144,10 @@ locals { | |||
|
|||
kubeconfig = var.create_eks ? templatefile("${path.module}/templates/kubeconfig.tpl", { | |||
kubeconfig_name = local.kubeconfig_name | |||
endpoint = aws_eks_cluster.this[0].endpoint | |||
cluster_auth_base64 = aws_eks_cluster.this[0].certificate_authority[0].data | |||
endpoint = length(aws_eks_cluster.this) > 0 ? aws_eks_cluster.this[0].endpoint : "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the splat syntax instead.
coalescelist(aws_eks_cluster.this[*]. endpoint, [""])[0]
This will return ""
if the state is empty.
aws_authenticator_command = var.kubeconfig_aws_authenticator_command | ||
aws_authenticator_command_args = length(var.kubeconfig_aws_authenticator_command_args) > 0 ? var.kubeconfig_aws_authenticator_command_args : ["token", "-i", aws_eks_cluster.this[0].name] | ||
aws_authenticator_command_args = length(var.kubeconfig_aws_authenticator_command_args) > 0 ? var.kubeconfig_aws_authenticator_command_args : ["token", "-i", var.cluster_name] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coalescelist(aws_eks_cluster.this[*].name, [""])[0]
This is true for all your change.
@@ -6,7 +6,7 @@ resource "aws_autoscaling_group" "workers" { | |||
"-", | |||
compact( | |||
[ | |||
aws_eks_cluster.this[0].name, | |||
var.cluster_name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the splat syntax instead : coalescelist(aws_eks_cluster.this[*].name, [""])[0]
This is true for all your change.
Thanks @ageekymonk for your work. I'm closing this in favor of #1041 |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Terraform destroy fails when state is empty
Description
The terraform destroy fails on any incomplete run because there is reference of name everywhere. Replacing the name with user provided one. Fixes #568
Checklist