-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Possible to reference ASGs created by EKS managed node groups? #1935
Comments
yes, this is already exposed since the whole map of attributes from node groups is provided as an output |
Thanks for the quick reply.
I'll dig into using that map, thanks. |
it will be something like locals {
asg_names = [
for group in module.eks.eks_managed_node_groups: [
for asg in group.node_group_resources.autoscaling_groups:
asg.name
]
} I did not test this but just a rough guess looking at the docs |
This issue has been resolved in version 18.12.0 🎉 |
Hi, I need to reference ASG's arn to create a event pattern to create cloudwatch event bridge. how do i retrieve the ARN of ASG created for EKS managed node groups besides the name ? |
you can build the ARN yourself using the names provided by the module output |
ASG's ARN looks something like this .. arn:aws:autoscaling:us-west-2:{AWS-Account}:autoScalingGroup:{AWS HASHKEY}:autoScalingGroupName/{ASG-name} How do i retrieve the aws hash key in order to form the complete ARN. ? |
@bryantbiggs while using the data source mentioned above, i was able to retrieve the ASG's ARN of EKS managed node groups. however, whenever i provision a new cluster the data source not retrieving the data from ASG and fails at the first time, and works if i re run terraform plan and apply again next time. any idea why this is happening ? |
Because the ASG is created after applying - the EKS managed node group service creates the ASG so you can't query something until it exists |
I have added 'depends on' on data source block to make sure it queries after the EKS managed node groups and cluster is cleated and it did not help. |
I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Is your request related to a new offering from AWS?
No.
Is your request related to a problem? Please describe.
We are using eks managed node groups and I am trying to see if there is a way we can reference the ASGs the module creates for each node group. We use the ARNs from the ASGs for our cluster autoscaler IAM policy and the names from the ASGs to tag our ASGs so cluster autoscaler can scale to zero.
It appears the
eks-managed-node-group
submodule creates theaws_launch_template
resource but I do not see anaws_autoscaling_group
resource created within that submodule. I do see one created when using theself-managed-node-group
submodule, though, and the respective outputs available.Is it possible to reference the ASGs created when using eks managed node groups from the module? I don't see the ASGs in our terraform state (just the launch templates) so I'm not sure this is possible, but wanted to verify. I searched through the docs and issues here before posting so apologies if this is an obvious solution I am overlooking or if I am misunderstanding how these ASGs are created using the module and submodules.
Describe the solution you'd like.
Ideally I would like to reference the ASGs as outputs from the module rather than pulling their info in from a data source.
Describe alternatives you've considered.
We are currently looking these ASGs up using a data source:
To tag our autoscaling groups:
This works, but for example, if we change something that creates a new node group, we won't pick up that new ASG until our pipeline runs a second time.
We also use the ASG ARNs from the data source for our cluster autoscaler policy:
But again, if a change is made that requires new ASGs, these won't be picked up until our pipeline is run again.
Additional context
The text was updated successfully, but these errors were encountered: