Skip to content

v1.4.0: add cloudtrail-key, cloudtrail submodules #28

Merged
merged 60 commits into from
Nov 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
595385d
exclude cloudtrail_orig
badra001 Nov 12, 2021
95f2d5f
rename
badra001 Nov 12, 2021
ac1b065
ignore examples
badra001 Nov 15, 2021
efa4b2d
ignore examples for tfdocs
badra001 Nov 15, 2021
b74e494
add cloudtrail-key
badra001 Nov 15, 2021
be8bee9
update kms_admin_root
badra001 Nov 15, 2021
aa233ae
fix policy doc
badra001 Nov 15, 2021
82a4186
add files (initial)
badra001 Nov 15, 2021
0f3ccf5
fix
badra001 Nov 15, 2021
a6c3b99
update base
badra001 Nov 15, 2021
541359b
remove role
badra001 Nov 15, 2021
158c55d
fix
badra001 Nov 15, 2021
66fef81
fix
badra001 Nov 15, 2021
ee78dd6
update
badra001 Nov 15, 2021
4d5dc8c
fix
badra001 Nov 16, 2021
864e420
fix
badra001 Nov 16, 2021
9381371
fix
badra001 Nov 16, 2021
433ae6e
setup for enable_sns
badra001 Nov 16, 2021
183fbe8
fix
badra001 Nov 16, 2021
2ec53a3
make enable_sqs first pass
badra001 Nov 16, 2021
ab14f2e
fix
badra001 Nov 16, 2021
9e0b36d
fix
badra001 Nov 16, 2021
8b93440
fix log target prefix
badra001 Nov 16, 2021
1f30c36
add role
badra001 Nov 16, 2021
c496137
fix
badra001 Nov 16, 2021
259c2ff
add splunk generation
badra001 Nov 16, 2021
3f623d8
add organization
badra001 Nov 16, 2021
dfdb34b
replace null with empty string
badra001 Nov 16, 2021
b6ca146
fix
badra001 Nov 16, 2021
cb541ea
fix
badra001 Nov 16, 2021
60ca74f
fix
badra001 Nov 16, 2021
b6512f2
more org change
badra001 Nov 18, 2021
3ba5188
fix
badra001 Nov 22, 2021
ecd3251
add org trail variable
badra001 Nov 23, 2021
bbcda8e
remove policy_id
badra001 Nov 23, 2021
d51267b
replace key policy with that from s3 objct logging
badra001 Nov 23, 2021
6472786
fix
badra001 Nov 23, 2021
85309a6
add cw log key policy
badra001 Nov 23, 2021
b71aa2f
fix key
badra001 Nov 23, 2021
3d13ad7
fix cw arn
badra001 Nov 23, 2021
f0d9f88
add to policy for CW logs for org
badra001 Nov 23, 2021
f6b7552
fix
badra001 Nov 23, 2021
a0be971
fix
badra001 Nov 23, 2021
71ae191
fix
badra001 Nov 23, 2021
5570fc7
move policy to cloudtrail, fix
badra001 Nov 24, 2021
f609ce9
fix
badra001 Nov 24, 2021
3362c30
fix prefix
badra001 Nov 24, 2021
b31c37e
add splunk_name for configs
badra001 Nov 24, 2021
d75fe31
fix name in template
badra001 Nov 24, 2021
ec1040a
fix
badra001 Nov 24, 2021
d069fb4
update key perms
badra001 Nov 26, 2021
f79e3f5
add comments
badra001 Nov 26, 2021
f84ddb6
change case
badra001 Nov 26, 2021
d98ef79
add encryption to sns
badra001 Nov 26, 2021
7ef9fb9
add cw retention into defaults
badra001 Nov 26, 2021
6169822
fix
badra001 Nov 26, 2021
accc566
change retention
badra001 Nov 26, 2021
918785d
fix
badra001 Nov 26, 2021
98eb072
add decrypt to cloudtrail policy
badra001 Nov 26, 2021
6b398bd
update readme
badra001 Nov 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ repos:
args: ['table']
exclude: common/*.tf
exclude: version.tf
exclude: examples
- id: terraform_tflint
args: [ "--args=--config=__GIT_WORKING_DIR__/.tflint.hcl"]
exclude: cloudtrail_orig
exclude: examples
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,9 @@
* v1.13.3 -- 20211122
- config
- fix by commenting policy_id from sqs policies

* v1.14.0 -- 20211115
- cloudtrail-key
- create module to setup a KMS key per region for cloudtrail
- cloudtrail
- create module to setup needed resources for cloudtrail, cloudwatch logs, sns, sqs, and splunk
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,23 @@ This sets the SES domain of the form `{account_id}.aws.mail.census.gov`. At this
so be sure run it in the west region for govcloud.

### object-logging
### cloudtrail
### config

This is in its own module [aws-setup-s3-object-logging](https://github.e.it.census.gov/terraform-modules/aws-setup-s3-object-logging).

### [cloudtrail-key](cloudtrail-key)

This creates a KMS key (region specific) for use by CloudTrail and all its resources (Cloudwatch Log, SNS, SQS, S3).

### [cloudtrail](cloudtrail)

This creates a CloudTrail (region specific) and supporing resources Cloudwatch Log, SNS, SQS, S3. It requires a KMS
key created specifically for this, from [cloudtrail-key](cloudtrail-key) above. It also creates Splunk input
configuration files.

### [config](config)

This creates the Config setup, a few Config Rules, SNS and SQS and Splunk input configurations files.

### gpg-key

## Submodules :: Common
Expand Down
99 changes: 99 additions & 0 deletions cloudtrail-key/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# aws-inf-setup :: cloudtrail-keys

This set up the KMS key used by Cloudtrail for the ts S3 bucket, CloudTrail, and SQS (if possible).

* Cloudtrail
* S3 bucket
* SQS

## Usage, Simple Example
Here is a simple example, the one most commonly expected to be used.

```hcl
module "cloudtrail_key_simple" {
source = "git@github.e.it.census.gov:terraform-modules/aws-inf-setup.git//cloudtrail-key"
tags = {
Environment = "csvd:infrastructure"
}
}
```

## Usage, Longer Example
This one can be used if you need to customize stuff, though really, the defaults are all built
for a reason, and deployment code (i.e., Ansible) will expect these defaults to be used in
variable file generation.

```hcl
module "cloudtrail_key_full" {
source = "git@github.e.it.census.gov:terraform-modules/aws-inf-setup.git//cloudtrail-key"
name = "mycloudtrail"
kms_admin_roles = ["arn:aws:iam::079788916859:role/r-inf-cloud-admin"]
kms_policy_document = data.aws_iam_policy_document.myct_policy.json
tags = {
Environment = "csvd:infrastructure"
}
component_tags = {
"kms" = {
"SpecialTag1" = "something"
"SpecialTag2" = "somethingElse"
}
}
}
```

## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.66.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.66.0 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [aws_kms_alias.key](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_alias) | resource |
| [aws_kms_key.key](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_key) | resource |
| [aws_arn.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/arn) | data source |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_iam_policy_document.empty](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.key](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.key_admin](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.key_orig](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.key_policy_combined](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_account_alias"></a> [account\_alias](#input\_account\_alias) | AWS Account Alias | `string` | `""` | no |
| <a name="input_account_id"></a> [account\_id](#input\_account\_id) | AWS Account ID (default will pull from current user) | `string` | `""` | no |
| <a name="input_component_tags"></a> [component\_tags](#input\_component\_tags) | Additional tags for Components (s3, kms, ddb) | `map(map(string))` | <pre>{<br> "ddb": {},<br> "kms": {},<br> "s3": {}<br>}</pre> | no |
| <a name="input_kms_admin_roles"></a> [kms\_admin\_roles](#input\_kms\_admin\_roles) | AWS KMS Key administrative role(s) which have full access to the key. The root user is included by default. | `list(string)` | `[]` | no |
| <a name="input_kms_policy_document"></a> [kms\_policy\_document](#input\_kms\_policy\_document) | AWS KMS Key Policy Document JSON, merged with admin policy document | `string` | `null` | no |
| <a name="input_name"></a> [name](#input\_name) | Name to apply to Cloudtrail KMS Key (default: k-inf-cloudtrail) | `string` | `null` | no |
| <a name="input_override_prefixes"></a> [override\_prefixes](#input\_override\_prefixes) | Override built-in prefixes by component (efs, s3, ebs, kms, role, policy, security-group). This should be used primarily for common infrastructure things | `map(string)` | `{}` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | AWS Tags to apply to appropriate resources (S3, KMS). Do not include safeguard tags here, use the data\_safeguard field for such things. | `map(string)` | `{}` | no |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_kms_aliase_nam"></a> [kms\_aliase\_nam](#output\_kms\_aliase\_nam) | Cloudtrail Key Alias name |
| <a name="output_kms_key_arn"></a> [kms\_key\_arn](#output\_kms\_key\_arn) | Cloudtrail Key ARN |
| <a name="output_kms_key_id"></a> [kms\_key\_id](#output\_kms\_key\_id) | Cloudtrail Key ID |
1 change: 1 addition & 0 deletions cloudtrail-key/base_tags.tf
1 change: 1 addition & 0 deletions cloudtrail-key/data.tf
1 change: 1 addition & 0 deletions cloudtrail-key/defaults.tf
Loading