Skip to content

Commit f01b9d9

Browse files
authored
Add audit-cloudtrail (#11)
* Add `cloudtrail-audit` * Rename to `audit-cloudtrail`
1 parent a76b963 commit f01b9d9

File tree

5 files changed

+78
-21
lines changed

5 files changed

+78
-21
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This is a collection of reusable root modules for CloudPosse AWS accounts.
1111
Use the `terraform-root-modules` Docker image as the base image in the application `Dockerfile`, and copy the modules from `/aws` folder into `/conf` folder
1212

1313
```dockerfile
14-
FROM cloudposse/terraform-root-modules:0.2.2 as terraform-root-modules
14+
FROM cloudposse/terraform-root-modules:0.3.1 as terraform-root-modules
1515

1616
FROM cloudposse/geodesic:0.9.18
1717

aws/audit-cloudtrail/main.tf

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
terraform {
2+
required_version = ">= 0.11.2"
3+
4+
backend "s3" {}
5+
}
6+
7+
variable "aws_assume_role_arn" {
8+
type = "string"
9+
}
10+
11+
provider "aws" {
12+
assume_role {
13+
role_arn = "${var.aws_assume_role_arn}"
14+
}
15+
}
16+
17+
variable "namespace" {
18+
type = "string"
19+
description = "Namespace (e.g. `cp` or `cloudposse`)"
20+
}
21+
22+
variable "stage" {
23+
type = "string"
24+
description = "Stage (e.g. `audit`)"
25+
default = "audit"
26+
}
27+
28+
variable "name" {
29+
type = "string"
30+
description = "Name (e.g. `account`)"
31+
default = "account"
32+
}
33+
34+
variable "region" {
35+
type = "string"
36+
description = "AWS region"
37+
}
38+
39+
module "cloudtrail" {
40+
source = "git::https://github.com/cloudposse/terraform-aws-cloudtrail.git?ref=tags/0.3.0"
41+
namespace = "${var.namespace}"
42+
stage = "${var.stage}"
43+
name = "${var.name}"
44+
enable_logging = "true"
45+
enable_log_file_validation = "true"
46+
include_global_service_events = "true"
47+
is_multi_region_trail = "true"
48+
s3_bucket_name = "${module.cloudtrail_s3_bucket.bucket_id}"
49+
}
50+
51+
module "cloudtrail_s3_bucket" {
52+
namespace = "${var.namespace}"
53+
stage = "${var.stage}"
54+
name = "${var.name}"
55+
region = "${var.region}"
56+
}
57+
58+
output "cloudtrail_bucket_domain_name" {
59+
value = "${module.cloudtrail_s3_bucket.bucket_domain_name}"
60+
}
61+
62+
output "cloudtrail_bucket_id" {
63+
value = "${module.cloudtrail_s3_bucket.bucket_id}"
64+
}
65+
66+
output "cloudtrail_bucket_arn" {
67+
value = "${module.cloudtrail_s3_bucket.bucket_arn}"
68+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
namespace="cp"
2+
stage="audit"
3+
name="account"
4+
region="us-west-2"

aws/cloudtrail/main.tf

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ terraform {
44
backend "s3" {}
55
}
66

7-
variable "aws_assume_role_arn" {}
7+
variable "aws_assume_role_arn" {
8+
type = "string"
9+
}
810

911
provider "aws" {
1012
assume_role {
@@ -24,28 +26,10 @@ variable "stage" {
2426

2527
variable "name" {
2628
type = "string"
27-
description = "Application or solution name (e.g. `app`)"
29+
description = "Name (e.g. `account`)"
2830
default = "account"
2931
}
3032

31-
variable "delimiter" {
32-
type = "string"
33-
default = "-"
34-
description = "Delimiter to be used between `namespace`, `stage`, `name` and `attributes`"
35-
}
36-
37-
variable "attributes" {
38-
type = "list"
39-
default = []
40-
description = "Additional attributes (e.g. `1`)"
41-
}
42-
43-
variable "tags" {
44-
type = "map"
45-
default = {}
46-
description = "Additional tags (e.g. map(`BusinessUnit`,`XYZ`)"
47-
}
48-
4933
module "cloudtrail" {
5034
source = "git::https://github.com/cloudposse/terraform-aws-cloudtrail.git?ref=tags/0.3.0"
5135
namespace = "${var.namespace}"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
namespace="cp"
22
stage="staging"
3+
name="account"

0 commit comments

Comments
 (0)