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

cloudwatchevent_rule: Add Support for Input Transformer Feature #61412

Open
wants to merge 2 commits into
base: devel
from

Conversation

@ichekaldin
Copy link

commented Aug 27, 2019

SUMMARY

Input Transformer feature of CloudWatch Event rules can be used to customize the text that is taken from an event before it is input to the target of a rule. Details and examples can be found here.

This commit adds logic to cloudwatchevent_rule module to define input transformer.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

cloudwatchevent_rule

ADDITIONAL INFORMATION

Example use case: AWS Config compliance change notifications. These can be made human-readable by something like this:

cloudwatchevent_rule:
  name: MyConfigComplianceRule
  event_pattern: '{"source":["aws.config"],"detail-type":["Config Rules Compliance Change"]}'
  description: Send notification when Config compliance changes
  targets:
    - id: notifications
      arn: arn:aws:sns:us-east-1:123456789012:notifications
      input_transformer:
        input_paths_map:
          region: $.region
          account: $.account
          title: $.detail-type
          rule-name: $.detail.configRuleName
          resource: $.detail.resourceId
          result: $.detail.newEvaluationResult.complianceType
        input_template: '"<title>. Account: <account>. Region: <region>. Config rule: <rule-name>. Resource <resource> changed to <result>"'

which produces a notification similar to this:

Config Rules Compliance Change. Account: 123456789012. Region: us-east-1. Config rule vpc-default-security-group-closed. Resource sg-1234abcd changed to COMPLIANT.
@ansibot

This comment has been minimized.

Copy link
Contributor

commented Aug 27, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Aug 27, 2019

@ichekaldin, just so you are aware we have a dedicated Working Group for aws.
You can find other people interested in this in #ansible-aws on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Aug 27, 2019

The test ansible-test sanity --test pep8 [explain] failed with 3 errors:

lib/ansible/modules/cloud/amazon/cloudwatchevent_rule.py:291:15: E111 indentation is not a multiple of four
lib/ansible/modules/cloud/amazon/cloudwatchevent_rule.py:292:19: E111 indentation is not a multiple of four
lib/ansible/modules/cloud/amazon/cloudwatchevent_rule.py:293:21: E121 continuation line under-indented for hanging indent

click here for bot help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.