Skip to content
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

improvement: Removed dependency on external template provider #854

Merged
merged 5 commits into from
May 6, 2020

Conversation

dpiddockcmp
Copy link
Contributor

@dpiddockcmp dpiddockcmp commented May 1, 2020

PR o'clock

Description

Removed dependency on the external template provider and instead used the Terraform native templatefile() function. As recommended by the provider itself.

My primary goal was to stop unnecessary recreation of worker launch templates and configurations when certain other resources are modified, for example the aws_eks_cluster. For example, changing the IP whitelist on the cluster public endpoint should not impact worker nodes. Previously:

  • the resource would be marked as "unknown" in the Refresh stage
  • the data_template_file userdatas could not be refreshed and so were in an unknown state during Plan stage
  • thus generating unnecessary pending recreation of launch config/templates

Thought I'd go the full mile and also convert kubeconfig. I moved some of the logic into the template itself to make the terraform easier to read.

Questions for maintainers

  • The userdata lists are now locals and not data sources. Should they be moved to locals.tf or workers.tf/workers_launch_template.tf? I don't think they should remain in data.tf even if it makes history a little harder to follow.
  • kubeconfig is a YAML file. Should we use yamlencode, like in aws-auth, instead of a template? It will make the locals messy again but the output YAML should always be valid.

Checklist

Push logic from terraform down to the template. Makes the formatting
slightly easier to follow
Updates to the eks_cluster now do not trigger recreation of launch
configurations
@barryib
Copy link
Member

barryib commented May 4, 2020

Awesome ❤️! This will increase readability and consistency.

The userdata lists are now locals and not data sources. Should they be moved to locals.tf or workers.tf/workers_launch_template.tf? I don't think they should remain in data.tf even if it makes history a little harder to follow.

I'll prefer to have all locals into the locals.tf file.

kubeconfig is a YAML file. Should we use yamlencode, like in aws-auth, instead of a template? It will make the locals messy again but the output YAML should always be valid.

I think we can continue to use templatefile, it make the kubeconfig easily reusable between LT and LC.

@max-rocket-internet max-rocket-internet changed the title improvement: Removed depencency on external template provider improvement: Removed dependency on external template provider May 5, 2020
@barryib
Copy link
Member

barryib commented May 5, 2020

@max-rocket-internet any thought ?

@max-rocket-internet
Copy link
Contributor

Looks amazing 💗 I'll test it

@max-rocket-internet
Copy link
Contributor

max-rocket-internet commented May 5, 2020

@dpiddockcmp would you like to be a maintainer of this module? Your contributions have been outstanding and I am spending less time on this project these days. And I see you're already a member?

I already asked you this some months back on a PR but perhaps you didn't see it 🙂

Copy link
Contributor

@max-rocket-internet max-rocket-internet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a quick plan on 2 clusters and LGTM 🎉

Copy link
Member

@barryib barryib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tested twice and it's LGTM ❤️❤️❤️

@dpiddockcmp can you please remove template provider in example ? There are not needed anymore. Like https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/examples/basic/main.tf#L22-L24

Copy link
Member

@barryib barryib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging. I'll open another PR to remove template in examples.

@barryib barryib merged commit b183b97 into terraform-aws-modules:master May 6, 2020
@dpiddockcmp
Copy link
Contributor Author

Merging. I'll open another PR to remove template in examples.

Oops, I had a couple busy days and was going to do the requested changes today. Thanks for sorting it out.

I'll prefer to have all locals into the locals.tf file.

This change wasn't done either before merging

kubeconfig is a YAML file. Should we use yamlencode, like in aws-auth, instead of a template? It will make the locals messy again but the output YAML should always be valid.

I think we can continue to use templatefile, it make the kubeconfig easily reusable between LT and LC.

I think you're thinking of the userdata 🙂 . Generated kubeconfig is only useful for end users now.

@dpiddockcmp would you like to be a maintainer of this module? Your contributions have been outstanding and I am spending less time on this project these days. And I see you're already a member?

I already asked you this some months back on a PR but perhaps you didn't see it 🙂

@max-rocket-internet I must have missed that. Sure, I'll be a maintainer 😄

@barryib
Copy link
Member

barryib commented May 6, 2020

PR to update examples #863

@barryib
Copy link
Member

barryib commented May 6, 2020

I'll prefer to have all locals into the locals.tf file.

This change wasn't done either before merging

Oops. I'll move them in #865

@max-rocket-internet
Copy link
Contributor

Sure, I'll be a maintainer 😄

Done 🚀

@dpiddockcmp dpiddockcmp deleted the template_file branch May 7, 2020 18:57
@barryib barryib mentioned this pull request May 7, 2020
2 tasks
dpiddockcmp pushed a commit to dpiddock/terraform-aws-eks that referenced this pull request May 15, 2020
dpiddockcmp added a commit that referenced this pull request Jun 5, 2020
Broke use case of passing in custom template content. Reverts most of the following PRs:
- #865
- #863 
- #854
barryib pushed a commit to Polyconseil/terraform-aws-eks that referenced this pull request Oct 25, 2020
Broke use case of passing in custom template content. Reverts most of the following PRs:
- terraform-aws-modules#865
- terraform-aws-modules#863 
- terraform-aws-modules#854
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants