terraform-aws-modules / terraform-aws-autoscaling

Terraform module to create AWS Auto Scaling resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/autoscaling/aws
Apache License 2.0
292 stars 557 forks source link

feat: Add support for aws_autoscaling_policy #175

Closed Sudokamikaze closed 2 years ago

Sudokamikaze commented 2 years ago

Description

This PR adds support for aws_autoscaling_policy resource

Support is fully complete and covers all settings mentioned in documentation(https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_policy)

Motivation and Context

I decided to implement support for this resource, as it's a part of ASGs, brings (important in my opinion) feature to scale-in / scale out based on CPU load metric (predefined_metric_type = ASGAverageCPUUtilization)

How Has This Been Tested?

Sudokamikaze commented 2 years ago

Good start. Please update the code in the examples and docs in README.

Agreed, I'll update them and will let you know once it's done, thank you :)

Qanop commented 2 years ago

Great message! I was just looking for this solution today while modifying the code.

Sudokamikaze commented 2 years ago

@antonbabenko I've added example based on average CPU load and added missing outputs

Sudokamikaze commented 2 years ago

@bryantbiggs Hey, TYVM for the review & changes

I've implemented them, slightly tested by plan & updated documentation slightly

Sudokamikaze commented 2 years ago

Looks pretty good. There are few remaining comments, also please update outputs in examples, and make CI green&passing. Thanks!

BTW, I'm seeing First-time contributors need a maintainer to approve running workflows. Learn more. each time, it could be much better if those linters could run without approval, so I could fix it before asking you to re-review

Also I forgot to mention, in previous review round, I implemented target_value as required argument for both blocks (to align more with official documentation)

antonbabenko commented 2 years ago

This is how GitHub is working for us. You don't need to wait for GitHub Actions to run after you commit, because you can run pre-commit run -a to make all required changes locally before committing, and GitHub Actions will do the same and it will be green afterward. Also, you can run this once - pre-commit install --install-hooks and then run git commit normally.

I've just run it locally.

Thank you very much for this PR! I am going to merge it now.

antonbabenko commented 2 years ago

This PR is included in version 4.11.0 :tada:

Sudokamikaze commented 2 years ago

This is how GitHub is working for us. You don't need to wait for GitHub Actions to run after you commit, because you can run pre-commit run -a to make all required changes locally before committing, and GitHub Actions will do the same and it will be green afterward. Also, you can run this once - pre-commit install --install-hooks and then run git commit normally.

I've just run it locally.

Thank you very much for this PR! I am going to merge it now.

Huge thank you! In this PR I learned good practices and looking forward to contribute to your modules, next time it'll be much less to review ;)

antonbabenko commented 2 years ago

You are more than welcome! We have plenty of work to do in terraform-aws-modules.

github-actions[bot] commented 1 year ago

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.