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

feat: Add create_autoscaling_group option and extra outputs #2067

Merged

Conversation

sethpollack
Copy link
Contributor

Description

adds create_autoscaling_group to self-managed-node-groups and adds image_id and user_data outputs.

Motivation and Context

Currently to use this module with something like karpenter or spotinst you need to create a nodegroup and scale it down in order to have the iam role, userdata, etc. created for you.

You can then do something like this to get all the data you need:

data "aws_autoscaling_group" "spotinst" {
  name = module.eks.self_managed_node_groups["spotinst"].autoscaling_group_name
}

data "aws_launch_configuration" "spotinst" {
  name = data.aws_autoscaling_group.spotinst.launch_configuration
}

iam_instance_profile  = data.aws_launch_configuration.spotinst.iam_instance_profile
security_groups       = data.aws_launch_configuration.spotinst.security_groups
image_id              = data.aws_launch_configuration.spotinst.image_id
user_data             = data.aws_launch_configuration.spotinst.user_data

This PR eliminates the extra hoops by adding the create_autoscaling_group option and exporting the image_id and user_data.

@sethpollack sethpollack changed the title add create_autoscaling_group option and extra outputs feat: add create_autoscaling_group option and extra outputs May 10, 2022
@sethpollack sethpollack changed the title feat: add create_autoscaling_group option and extra outputs feat: Add create_autoscaling_group option and extra outputs May 10, 2022
@bryantbiggs
Copy link
Member

Thanks for the PR @sethpollack - I think the addition of create_autoscaling_group is great and can see its use case. However, since this project does not use launch configuration and only supports launch template, do we still need to export ami_id and user_data? This is all typically handled in the exported launch template which I know Karpenter uses, I haven't worked with Spotinst though

@bryantbiggs
Copy link
Member

bryantbiggs commented May 12, 2022

Lets also add this create_autoscaling_group variable to the root node_groups.tf please

Missed this - already there, thanks!

@sethpollack
Copy link
Contributor Author

@bryantbiggs No spotinst doesn't use a launch template, you need to provide those values: https://registry.terraform.io/providers/spotinst/spotinst/latest/docs/resources/ocean_aws

@bryantbiggs bryantbiggs changed the title feat: Add create_autoscaling_group option and extra outputs feat: Add create_autoscaling_group option and extra outputs May 12, 2022
Copy link
Member

@bryantbiggs bryantbiggs left a comment

Choose a reason for hiding this comment

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

Thank you for the PR!

@bryantbiggs bryantbiggs merged commit 58420b9 into terraform-aws-modules:master May 12, 2022
antonbabenko pushed a commit that referenced this pull request May 12, 2022
## [18.21.0](v18.20.5...v18.21.0) (2022-05-12)

### Features

* Add `create_autoscaling_group` option and extra outputs ([#2067](#2067)) ([58420b9](58420b9))
@antonbabenko
Copy link
Member

This PR is included in version 18.21.0 🎉

@sethpollack
Copy link
Contributor Author

Thanks!

it-without-politics pushed a commit to it-without-politics/terraform-aws-eks that referenced this pull request May 23, 2022
it-without-politics pushed a commit to it-without-politics/terraform-aws-eks that referenced this pull request May 23, 2022
spr-mweber3 pushed a commit to spring-media/terraform-aws-eks that referenced this pull request May 24, 2022
spr-mweber3 pushed a commit to spring-media/terraform-aws-eks that referenced this pull request May 24, 2022
baibailiha added a commit to baibailiha/terraform-aws-eks that referenced this pull request Sep 13, 2022
@github-actions
Copy link

github-actions bot commented Nov 9, 2022

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 9, 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.

3 participants