-
Notifications
You must be signed in to change notification settings - Fork 342
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
cloudwatch_metric_alarm - Changes to alarms always report 'changed' due to dimensions #1750
Closed
1 task done
Labels
needs_verified
Some one might want to take a look at this and reproduce it to confirm
Comments
gravesm
added
needs_verified
Some one might want to take a look at this and reproduce it to confirm
and removed
needs_triage
labels
Sep 12, 2023
Hello, can I take this issue and open PR if necessary? |
@KamilBlaz yes, thank you for volunteering to help! |
abikouo
added a commit
to abikouo/amazon.aws
that referenced
this issue
Oct 24, 2023
Hi @KamilBlaz, is this something you are still planning on picking up? |
patchback bot
pushed a commit
that referenced
this issue
Aug 28, 2024
…#1865) SUMMARY A metric alarm in Cloudwatch can optionally have Dimensions. When a metric alarm in Cloudwatch does not have any dimensions, it returns: "Dimensions": [] when queried via boto3. When configuring a metric alarm without Dimensions in Cloudwatch using the cloudwatch_metric_alarm plugin, Dimensions must be absent from the parameters. Because "Dimensions": [] does not match Dimensions: None, the result is always Changed. This Pull Request fixes this by setting Dimensions from the returned alarm parameters to None when the field is empty. Fixes #1750 ISSUE TYPE Bugfix Pull Request COMPONENT NAME cloudwatch_metric_alarm ADDITIONAL INFORMATION Reviewed-by: GomathiselviS Reviewed-by: Jasper Misset Reviewed-by: Alina Buzachis Reviewed-by: Mark Chappell (cherry picked from commit dc574ca)
softwarefactory-project-zuul bot
pushed a commit
that referenced
this issue
Aug 28, 2024
…#1865) (#2256) This is a backport of PR #1865 as merged into main (dc574ca). SUMMARY A metric alarm in Cloudwatch can optionally have Dimensions. When a metric alarm in Cloudwatch does not have any dimensions, it returns: "Dimensions": [] when queried via boto3. When configuring a metric alarm without Dimensions in Cloudwatch using the cloudwatch_metric_alarm plugin, Dimensions must be absent from the parameters. Because "Dimensions": [] does not match Dimensions: None, the result is always Changed. This Pull Request fixes this by setting Dimensions from the returned alarm parameters to None when the field is empty. Fixes #1750 ISSUE TYPE Bugfix Pull Request COMPONENT NAME cloudwatch_metric_alarm ADDITIONAL INFORMATION Reviewed-by: Mark Chappell
braydencw1
pushed a commit
to braydencw1/amazon.aws
that referenced
this issue
Aug 29, 2024
…ansible-collections#1865) SUMMARY A metric alarm in Cloudwatch can optionally have Dimensions. When a metric alarm in Cloudwatch does not have any dimensions, it returns: "Dimensions": [] when queried via boto3. When configuring a metric alarm without Dimensions in Cloudwatch using the cloudwatch_metric_alarm plugin, Dimensions must be absent from the parameters. Because "Dimensions": [] does not match Dimensions: None, the result is always Changed. This Pull Request fixes this by setting Dimensions from the returned alarm parameters to None when the field is empty. Fixes ansible-collections#1750 ISSUE TYPE Bugfix Pull Request COMPONENT NAME cloudwatch_metric_alarm ADDITIONAL INFORMATION Reviewed-by: GomathiselviS Reviewed-by: Jasper Misset Reviewed-by: Alina Buzachis Reviewed-by: Mark Chappell
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
When running CloudWatch metric alarm playbooks, existing alarms without dimensions report 'changed' even when no changes have been made to the alarm settings/props.
After debugging the cloudwatch_metric_alarm module code, looks like there is an issue with the Dimensions field.
If the alarm does not contain dimenions, it returns "Dimensions": [] to the module.
If dimensions is not present in the task, it is absent from the parameters. This causes the comparison in the module to return Changed.
Issue Type
Bug Report
Component Name
cloudwatch_metric_alarm
Ansible Version
Collection Versions
AWS SDK versions
Configuration
OS / Environment
No response
Steps to Reproduce
If you uncomment the dimensions and the key/value pair it contains, and run it more than once, it does not return Changed.
Expected Results
After the initial run of above playbook, future runs should report no changes (changed=0) unless settings/props are modified.
Actual Results
After initial playbook run, future playbook runs always report that changes are necessary and makes AWS call to create alarm again.
Code of Conduct
The text was updated successfully, but these errors were encountered: