amazon.aws icon indicating copy to clipboard operation
amazon.aws copied to clipboard

cloudwatchevent_rule always reports Changed = True

Open ichekaldin opened this issue 1 year ago • 2 comments

Summary

cloudwatchevent_rule module always reports Changed = True.

I believe this is caused to ansible-collections/community.aws#1355.

Output of boto3 describe_rule method only includes previously specified parameters. Therefore AWS _rule_matches_aws method ends up comparing something like this:

[{'id': 'my-target-id', 'arn': 'arn:aws:lambda:us-east-1:123412341234:function:my-function', 'role_arn': None, 'input': None, 'input_path': None, 'input_transformer': None, 'ecs_parameters': None}]

with describe_rule output that looks like this:

[{'id': 'my-target-id', 'arn': 'arn:aws:lambda:us-east-1:123412341234:function:my-function'}]

Issue Type

Bug Report

Component Name

cloudwatchevent_rule

Ansible Version

ansible [core 2.12.7]
  configured module search path = ['/usr/share/ansible/plugins/modules']
  python version = 3.8.13 (default, May  8 2022, 17:48:02) [Clang 13.1.6 (clang-1316.0.21.2)]
  jinja version = 3.1.2
  libyaml = False

Collection Versions

amazon.aws            4.1.0  
community.aws         4.1.1  

AWS SDK versions

Name: boto3
Version: 1.24.43
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email: 
License: Apache License 2.0
Requires: botocore, jmespath, s3transfer
Required-by: 
---
Name: botocore
Version: 1.27.43
Summary: Low-level, data-driven core of boto 3.
Home-page: https://github.com/boto/botocore
Author: Amazon Web Services
Author-email: 
License: Apache License 2.0
Requires: jmespath, python-dateutil, urllib3
Required-by: boto3, s3transfer

Configuration

$ ansible-config dump --only-changed

OS / Environment

No response

Steps to Reproduce

- community.aws.cloudwatchevent_rule:
    name: my-rule
    schedule_expression: "rate(1 day)"
    targets:
      - id: my-target
        arn: "arn:aws:lambda:us-east-1:123412341234:function:my-function"
    state: present

Expected Results

Module should return Changed = True on the first execution, and Changed = False on all subsequent executions.

Actual Results

Module always returns Changed = True.

Code of Conduct

  • [X] I agree to follow the Ansible Code of Conduct

ichekaldin avatar Aug 10 '22 05:08 ichekaldin

Files identified in the description:

  • [plugins/modules/cloudwatchevent_rule.py](https://github.com/['ansible-collections/amazon.aws', 'ansible-collections/community.aws', 'ansible-collections/community.vmware']/blob/main/plugins/modules/cloudwatchevent_rule.py)

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot avatar Aug 10 '22 05:08 ansibullbot

cc @jillr @jsdalton @markuman @s-hertel @tremble click here for bot help

ansibullbot avatar Aug 10 '22 05:08 ansibullbot