Giter VIP home page Giter VIP logo

terraform-aws-cloudtrail's Introduction

terraform-aws-cloudtrail

Terraform module for configuring AWS to integrate with Expel Workbench.

Configures a CloudTrail stack (CloudTrail & S3 bucket) with a notification queue that Expel Workbench consumes. Cloudtrail, S3 bucket, SQS and SNS (optionally for existing Cloudtrail) queue are encrypted by default using a custom managed KMS key.

Usage

module "expel_aws_cloudtrail" {
  source  = "expel-io/cloudtrail/aws"
  version = "1.3.0"

  expel_customer_organization_guid = "Replace with your organization GUID from Expel Workbench"
  region = "AWS region in which notification queue for CloudTrail will be created"
}

Once you have configured your AWS environment, go to https://workbench.expel.io/settings/security-devices?setupIntegration=aws and create an AWS CloudTrail security device to enable Expel to begin monitoring your AWS environment.

Permissions

The permissions allocated by this module allow Expel Workbench to perform investigations and get a broad understanding of your AWS footprint.

Use Cases

  1. Creating a new AWS CloudTrail for an AWS organization (default)
  2. Creating a new AWS CloudTrail for a single AWS account (Set enable_organization_trail input to false)
  3. Reusing an existing AWS Cloudtrail for a single AWS account or an AWS organization with all the existing resources deployed in the same account (Set existing_cloudtrail_bucket_name input to the name of the existing log bucket)

Limitations

  • This module only supports integrating with Expel when all the necessary resources are deployed in the same account.
  • This module does not support integrating with Expel when all the necessary resources are deployed across multiple aws accounts.

    Ex. ControlTower Environments are not supported via this module. To integrate an AWS ControlTower environment with Expel refer to this guide in order to do so.

Please contact your Engagement Manager if you have an existing CloudTrail with a different configuration.

Requirements

Name Version
terraform >= 1.1.0
aws >= 4.0.0
random >= 3.1.3

Inputs

Name Description Type Default Required
expel_customer_organization_guid Expel customer's organization GUID assigned to you by Expel. You can find it in your browser URL after navigating to Settings > My Organization in Workbench. string n/a yes
enable_access_logging_bucket_encryption Enable to encrypt objects in the access logging bucket. bool true no
enable_bucket_access_logging Access logging provides detailed records for the requests that are made to an Amazon S3 bucket. bool true no
enable_bucket_encryption_key_rotation If enable_s3_encryption is set to true, enabling key rotation will rotate the KMS keys used for S3 bucket encryption. bool true no
enable_bucket_versioning Enable to protect against accidental/malicious removal or modification of S3 objects. bool true no
enable_cloudtrail_log_file_validation Validates that a log file was not modified, deleted, or unchanged after CloudTrail delivered it. bool true no
enable_organization_trail For customers with AWS organizations setup, log events for the management account and all member accounts, and permeate IAM policies in all member accounts for Expel to get basic read permissions of resources in order to investigate alerts. Set to false if you want to onboard a single AWS account bool true no
enable_sqs_encryption Enable server-side encryption (SSE) of message content with SQS-owned encryption keys. bool true no
existing_cloudtrail_bucket_name The name of the existing bucket connected to the existing CloudTrail string null no
existing_cloudtrail_kms_key_arn The ARN of the KMS key used to encrypt existing CloudTrail bucket string null no
existing_sns_topic_arn The ARN of the existing SNS Topic configured to be notified by the existing CloudTrail bucket. The S3 bucket notification configuration must have the s3:ObjectCreated:* event type checked. string null no
expel_assume_role_session_name The session name Expel will use when authenticating. string "ExpelCloudTrailServiceSession" no
expel_aws_account_arn Expel's AWS Account ARN to allow assuming role to gain CloudTrail access. string "arn:aws:iam::012205512454:user/ExpelCloudService" no
expel_customer_aws_account_id Account id of customer's AWS account that will be monitored by Expel if it is different than the one terraform is using. This should be the management account id if organization trail is enabled. string null no
prefix A prefix to group all Expel integration resources. string "expel-aws-cloudtrail" no
queue_message_retention_days The visibility timeout for the queue. See: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html number 7 no
stackset_fault_tolerance_count The number of accounts, per Region, for which stackset deployment operation can fail before AWS CloudFormation stops the operation in that Region. number null no
tags A set of tags to group resources. map {} no

Outputs

Name Description
aws_region The AWS Region where the CloudTrail resources exist
role_arn IAM Role ARN of the role for Expel to assume to access CloudTrail data
role_session_name The session name Expel will use when authenticating
sqs_queue_url URL of the queue consuming from the S3 bucket

Resources

Name Type
aws_cloudformation_stack_set.permeate_account_policy resource
aws_cloudformation_stack_set_instance.permeate_account_policy resource
aws_cloudtrail.cloudtrail resource
aws_iam_policy.cloudtrail_manager_iam_policy resource
aws_iam_role.expel_assume_role resource
aws_iam_role_policy_attachment.cloudtrail_manager_role_policy_attachment resource
aws_kms_key.cloudtrail_bucket_encryption_key resource
aws_kms_key.notification_encryption_key resource
aws_s3_bucket.cloudtrail_access_log_bucket resource
aws_s3_bucket.cloudtrail_bucket resource
aws_s3_bucket_acl.cloudtrail_access_log_bucket_acl resource
aws_s3_bucket_acl.cloudtrail_bucket_acl resource
aws_s3_bucket_logging.cloudtrail_bucket_logging resource
aws_s3_bucket_notification.cloudtrail_bucket_notification resource
aws_s3_bucket_policy.cloudtrail_bucket_policy resource
aws_s3_bucket_public_access_block.cloudtrail_access_log_bucket_public_access_block resource
aws_s3_bucket_public_access_block.cloudtrail_bucket_public_access_block resource
aws_s3_bucket_server_side_encryption_configuration.cloudtrail_access_log_bucket_server_side_encryption_configuration resource
aws_s3_bucket_server_side_encryption_configuration.cloudtrail_bucket_server_side_encryption_configuration resource
aws_s3_bucket_versioning.cloudtrail_access_log_bucket_versioning resource
aws_s3_bucket_versioning.cloudtrail_bucket_versioning resource
aws_sns_topic.cloudtrail_sns_topic resource
aws_sns_topic_policy.sns_topic_policy resource
aws_sns_topic_subscription.cloudtrail_sns_topic_subscription resource
aws_sqs_queue.cloudtrail_queue resource
aws_sqs_queue_policy.sqs_bucket_policy resource
random_uuid.cloudtrail_bucket_name resource
random_uuid.cloudtrail_sns_topic_name resource
aws_caller_identity.current data source
aws_iam_policy_document.assume_role_iam_document data source
aws_iam_policy_document.cloudtrail_bucket_iam_document data source
aws_iam_policy_document.cloudtrail_key_policy_document data source
aws_iam_policy_document.cloudtrail_manager_iam_document data source
aws_iam_policy_document.notification_key_policy_document data source
aws_iam_policy_document.sns_queue_iam_document data source
aws_iam_policy_document.sns_topic_iam_document data source
aws_organizations_organization.current data source
aws_region.current data source

terraform-aws-cloudtrail's People

Contributors

bachu20 avatar davidmontoyago avatar ethanmil avatar jamesjuran2 avatar katharinemc avatar sarjumulmi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.