Component: cloudtrail

No description available.

Component: cloudtrail

This component is responsible for provisioning cloudtrail auditing in an individual account. It’s expected to be used alongside the cloudtrail-bucket component as it utilizes that bucket via remote state.

Usage

Stack Level: Global

Here’s an example snippet for how to use this component. It’s suggested to apply this component to all accounts, so put this snippet in each account’s global stack (E.g. gbl-root.yaml, gbl-devplatform.yaml, gbl-identity.yaml, etc.)

components:
  terraform:
    cloudtrail:
      vars:
        cloudtrail_bucket_environment_name: "uw2"
        cloudtrail_bucket_stage_name: "audit"
        cloudwatch_logs_retention_in_days: 730

Requirements

Name Version
terraform >= 0.12.0
aws >= 3.0
local >= 1.3
template >= 2.0

Providers

Name Version
aws >= 3.0
terraform n/a

Inputs

Name Description Type Default Required
additional_tag_map Additional tags for appending to tags_as_list_of_maps. Not added to tags. map(string) {} no
attributes Additional attributes (e.g. 1) list(string) [] no
cloudtrail_bucket_stage_name The stage (account) name where the CloudTrail bucket is provisioned string "audit" no
cloudtrail_cloudwatch_logs_role_max_session_duration The maximum session duration (in seconds) for the CloudTrail CloudWatch Logs role. Can have a value from 1 hour to 12 hours number 43200 no
cloudwatch_logs_retention_in_days Number of days to retain logs for. CIS recommends 365 days. Possible values are: 0, 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, and 3653. Set to 0 to keep logs indefinitely. number 365 no
context Single object for setting entire context at once.See description of individual variables for details.Leave string and numeric variables as null to use default value.Individual variable settings (non-null) override settings in context object,except for attributes, tags, and additional_tag_map, which are merged. object({ enabled = bool namespace = string environment = string stage = string name = string delimiter = string attributes = list(string) tags = map(string) additional_tag_map = map(string) regex_replace_chars = string label_order = list(string) id_length_limit = number }) { “additional_tag_map”: {}, “attributes”: [], “delimiter”: null, “enabled”: true, “environment”: null, “id_length_limit”: null, “label_order”: [], “name”: null, “namespace”: null, “regex_replace_chars”: null, “stage”: null, “tags”: {}} no
delimiter Delimiter to be used between namespace, environment, stage, name and attributes.Defaults to - (hyphen). Set to "" to use no delimiter at all. string null no
enable_log_file_validation Specifies whether log file integrity validation is enabled. Creates signed digest for validated contents of logs bool true no
enable_logging Enable logging for the trail bool true no
enabled Set to false to prevent the module from creating any resources bool null no
environment Environment, e.g. ‘uw2’, ‘us-west-2’, OR ‘prod’, ‘staging’, ‘dev’, ‘UAT’ string null no
id_length_limit Limit id to this many characters.Set to 0 for unlimited length.Set to null for default, which is 0.Does not affect id_full. number null no
import_role_arn IAM Role ARN to use when importing a resource string null no
include_global_service_events Specifies whether the trail is publishing events from global services such as IAM to the log files bool true no
is_multi_region_trail Specifies whether the trail is created in the current region or in all regions bool true no
label_order The naming order of the id output and Name tag.Defaults to [“namespace”, “environment”, “stage”, “name”, “attributes”].You can omit any of the 5 elements, but at least one must be present. list(string) null no
name Solution name, e.g. ‘app’ or ‘jenkins’ string null no
namespace Namespace, which could be your organization name or abbreviation, e.g. ‘eg’ or ‘cp’ string null no
regex_replace_chars Regex to replace chars with empty string in namespace, environment, stage and name.If not set, "/[^a-zA-Z0-9-]/" is used to remove all characters other than hyphens, letters and digits. string null no
region AWS Region string n/a yes
stage Stage, e.g. ‘prod’, ‘staging’, ‘dev’, OR ‘source’, ‘build’, ‘test’, ‘deploy’, ‘release’ string null no
tags Additional tags (e.g. map('BusinessUnit','XYZ') map(string) {} no
tfstate_account_id The ID of the account where the Terraform remote state backend is provisioned string "" no
tfstate_assume_role Set to false to use the caller’s role to access the Terraform remote state bool true no
tfstate_bucket_environment_name The name of the environment for Terraform state bucket string "" no
tfstate_bucket_stage_name The name of the stage for Terraform state bucket string "root" no
tfstate_existing_role_arn The ARN of the existing IAM Role to access the Terraform remote state. If not provided and remote_state_assume_role is true, a role will be constructed from remote_state_role_arn_template string "" no
tfstate_role_arn_template IAM Role ARN template for accessing the Terraform remote state string "arn:aws:iam::%s:role/%s-%s-%s-%s" no
tfstate_role_environment_name The name of the environment for Terraform state IAM role string "gbl" no
tfstate_role_name IAM Role name for accessing the Terraform remote state string "terraform" no
tfstate_role_stage_name The name of the stage for Terraform state IAM role string "root" no

Outputs

Name Description
cloudtrail_arn CloudTrail ARN
cloudtrail_home_region The region in which CloudTrail was created
cloudtrail_id CloudTrail ID
cloudtrail_logs_log_group_arn CloudTrail Logs log group ARN
cloudtrail_logs_log_group_name CloudTrail Logs log group name
cloudtrail_logs_role_arn CloudTrail Logs role ARN
cloudtrail_logs_role_name CloudTrail Logs role name

References