Documentation

aws_config_rule - Manage AWS Config resources

New in version 2.6.

Synopsis

  • Module manages AWS Config rules

Requirements

The below requirements are needed on the host that executes this module.

  • boto
  • boto3
  • botocore
  • python >= 2.6

Parameters

Parameter Choices/Defaults Comments
aws_access_key
AWS access key. If not set then the value of the AWS_ACCESS_KEY_ID, AWS_ACCESS_KEY or EC2_ACCESS_KEY environment variable is used.

aliases: ec2_access_key, access_key
aws_secret_key
AWS secret key. If not set then the value of the AWS_SECRET_ACCESS_KEY, AWS_SECRET_KEY, or EC2_SECRET_KEY environment variable is used.

aliases: ec2_secret_key, secret_key
description
The description that you provide for the AWS Config rule.
ec2_url
Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2_URL environment variable, if any, is used.
execution_frequency
    Choices:
  • One_Hour
  • Three_Hours
  • Six_Hours
  • Twelve_Hours
  • TwentyFour_Hours
The maximum frequency with which AWS Config runs evaluations for a rule.
input_parameters
A string, in JSON format, that is passed to the AWS Config rule Lambda function.
name
required
The name of the AWS Config resource.
profile
(added in 1.6)
Uses a boto profile. Only works with boto >= 2.24.0.
region
The AWS region to use. If not specified then the value of the AWS_REGION or EC2_REGION environment variable, if any, is used. See http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region

aliases: aws_region, ec2_region
scope
Defines which resources can trigger an evaluation for the rule.
compliance_types
The resource types of only those AWS resources that you want to trigger an evaluation for the rule. You can only specify one type if you also specify a resource ID for `compliance_id`.
tag_key
The tag key that is applied to only those AWS resources that you want to trigger an evaluation for the rule.
compliance_id
The ID of the only AWS resource that you want to trigger an evaluation for the rule. If you specify a resource ID, you must specify one resource type for `compliance_types`.
tag_value
The tag value applied to only those AWS resources that you want to trigger an evaluation for the rule. If you specify a value for `tag_value`, you must also specify a value for `tag_key`.
security_token
(added in 1.6)
AWS STS security token. If not set then the value of the AWS_SECURITY_TOKEN or EC2_SECURITY_TOKEN environment variable is used.

aliases: access_token
source
Provides the rule owner (AWS or customer), the rule identifier, and the notifications that cause the function to evaluate your AWS resources.
owner
The resource types of only those AWS resources that you want to trigger an evaluation for the rule. You can only specify one type if you also specify a resource ID for `compliance_id`.
identifier
The ID of the only AWS resource that you want to trigger an evaluation for the rule. If you specify a resource ID, you must specify one resource type for `compliance_types`.
details
Provides the source and type of the event that causes AWS Config to evaluate your AWS resources.
This parameter expects a list of dictionaries. Each dictionary expects the following key/value pairs.
Key `EventSource` The source of the event, such as an AWS service, that triggers AWS Config to evaluate your AWS resources.
Key `MessageType` The type of notification that triggers AWS Config to run an evaluation for a rule.
Key `MaximumExecutionFrequency` The frequency at which you want AWS Config to run evaluations for a custom rule with a periodic trigger.
state
    Choices:
  • present ←
  • absent
Whether the Config rule should be present or absent.
validate_certs
bool

(added in 1.5)
    Choices:
  • no
  • yes ←
When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0.

Notes

Note

  • If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence AWS_URL or EC2_URL, AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY or EC2_ACCESS_KEY, AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY or EC2_SECRET_KEY, AWS_SECURITY_TOKEN or EC2_SECURITY_TOKEN, AWS_REGION or EC2_REGION
  • Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See https://boto.readthedocs.io/en/latest/boto_config_tut.html
  • AWS_REGION or EC2_REGION can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file

Examples

- name: Create Config Rule for AWS Config
  aws_config_rule:
    name: test_config_rule
    state: present
    description: 'This AWS Config rule checks for public write access on S3 buckets'
    scope:
        compliance_types:
            - 'AWS::S3::Bucket'
    source:
        owner: AWS
        identifier: 'S3_BUCKET_PUBLIC_WRITE_PROHIBITED'

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance

This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.

For a list of other modules that are also maintained by the Ansible Community, see here.

Author

  • Aaron Smith (@slapula)

Hint

If you notice any issues in this documentation you can edit this document to improve it.