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

Instance Refresh not triggering on launch_template changes #1365

Closed
Patricol opened this issue May 18, 2021 · 14 comments · Fixed by #1370
Closed

Instance Refresh not triggering on launch_template changes #1365

Patricol opened this issue May 18, 2021 · 14 comments · Fixed by #1370

Comments

@Patricol
Copy link

Patricol commented May 18, 2021

Description

With the new instance refresh functionality, changes to the launch template will not trigger a refresh, because the autoscaling_group's launch_template block does not actually change if its version = $Latest, as is the case by default.

This is unexpected based on the comment here: A refresh will always be triggered by a change in any of launch_configuration, launch_template, or mixed_instances_policy.

I tested by changing ami_id multiple times; which never triggered an instance refresh.

All of the terraform resources appear to be created correctly; and I'm on the newest AWS provider (3.40.0).

I think this was just a misunderstanding of the intended behavior of aws_autoscaling_group's instance_refresh block.

I suppose this module could handle bumping an explicitly set launch_template version.

Versions

  • Terraform: v0.14.11
  • Provider(s):
+ provider registry.terraform.io/hashicorp/aws v3.40.0
+ provider registry.terraform.io/hashicorp/cloudinit v2.2.0
+ provider registry.terraform.io/hashicorp/external v2.1.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.2.0
+ provider registry.terraform.io/hashicorp/local v2.1.0
+ provider registry.terraform.io/hashicorp/null v3.1.0
+ provider registry.terraform.io/hashicorp/random v3.1.0
+ provider registry.terraform.io/hashicorp/template v2.2.0
+ provider registry.terraform.io/terraform-aws-modules/http v2.3.0
  • Module: 16.0.0

Reproduction

Skipping most repro descriptions because the module does correctly setup all the resources; they just don't behave as documented.

@barryib
Copy link
Member

barryib commented May 18, 2021

@Patricol Thanks for opening this. @bashims can you please have a look ? We probably missed something in your PR.

@barryib
Copy link
Member

barryib commented May 18, 2021

@Patricol did you tried the instace refresh's example ? Is that example works for you ? Can you please share your configuration ?

@bashims
Copy link
Contributor

bashims commented May 18, 2021

@barryib absolutely.

@Patricol can you try changing/adding a tag to the example ASG config. That should trigger the refresh.

In the meantime I will take a closer look to see what's going on.

@bashims
Copy link
Contributor

bashims commented May 18, 2021

@Patricol as a work around please add the following to your worker_groups_launch_template:

      instance_refresh_triggers            = ["tag"]
      tags = [
        {
          key                 = "test_trigger_refresh"
          value               = "true"
          propagate_at_launch = true
        },
     ]

@Patricol Patricol changed the title Instance Refresh not triggering on launch_template changes, probably due to version=latest Instance Refresh not triggering on launch_template changes May 18, 2021
@bashims
Copy link
Contributor

bashims commented May 18, 2021

@barryib I'm working on a fix now. We need to bump/change the launch_template version to trigger the instance_refresh. Triggering from tags works fine however.

@Patricol
Copy link
Author

Patricol commented May 18, 2021

@bashims That does work for me.

@stevehipwell
Copy link
Contributor

@bashims is there a reason why the node termination handler policy is added to the worker node role in the example?

@barryib
Copy link
Member

barryib commented May 19, 2021

@bashims is there a reason why the node termination handler policy is added to the worker node role in the example?

Nope. It should be attached to the node termination handler through IRSA.

@stevehipwell can you please open a PR to fix that ?

@stevehipwell
Copy link
Contributor

@barryib that's what I thought. Would you like me to also add the the spot instance termination and rebalance suggestion events to the example queue from the aws-node-termination-handler repo docs ?

@barryib
Copy link
Member

barryib commented May 19, 2021

@barryib that's what I thought. Would you like me to also add the the spot instance termination and rebalance suggestion events to the example queue from the aws-node-termination-handler repo docs ?

Yes you can if it's simple. Please add a link to the NTH docs also. People must follow that docs. The example is there for help only and not to address every NTH use cases.

@stevehipwell
Copy link
Contributor

@barryib #1373.

@barryib
Copy link
Member

barryib commented May 19, 2021

@barryib #1373.

Thanks. Merged.

@bashims
Copy link
Contributor

bashims commented May 19, 2021

@bashims is there a reason why the node termination handler policy is added to the worker node role in the example?

@stevehipwell I believe it is uses IRSA so there is no need for attaching it to the worker node role. This was probably a leftover i.e. before I switched to using IRSA. Thanks for removing the attachment.

@github-actions
Copy link

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.

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