Skip to content

Commit

Permalink
Merge pull request #17 from QuiNovas/develop
Browse files Browse the repository at this point in the history
added tags variable
  • Loading branch information
vchinnakotla authored Aug 13, 2021
2 parents c0be9bc + 10ede7f commit 034ff64
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cloudwatch.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ data "aws_iam_policy_document" "cloudwatch_assume_role" {
resource "aws_iam_role" "cloudwatch_logs" {
assume_role_policy = data.aws_iam_policy_document.cloudwatch_assume_role.json
name = local.associated_resource_name
tags = var.tags
}

resource "aws_cloudwatch_log_group" "cloudtrail" {
name = local.associated_resource_name
retention_in_days = 7
tags = var.tags
}

data "aws_iam_policy_document" "cloudwatch_logs_role" {
Expand Down
1 change: 1 addition & 0 deletions kms-key.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ resource "aws_kms_key" "cloudtrail" {
description = "cloudtrail log key for ${local.trail_name}"
enable_key_rotation = true
policy = data.aws_iam_policy_document.cloudtrail_kms.json
tags = var.tags
}

resource "aws_kms_alias" "cloudtrail" {
Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ resource "aws_cloudtrail" "cloudtrail" {
s3_bucket_name = aws_s3_bucket.cloudtrail.id
sns_topic_name = aws_sns_topic.cloudtrail.name

tags = {
tags = merge(var.tags, {
Name = local.trail_name
}
})
}

1 change: 1 addition & 0 deletions s3-bucket.tf
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ data "aws_iam_policy_document" "cloudtrail_s3" {
]
sid = "DenyUnsecuredTransport"
}
tags = var.tags
}

resource "aws_s3_bucket_policy" "cloudtrail" {
Expand Down
1 change: 1 addition & 0 deletions sns-topic.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
resource "aws_sns_topic" "cloudtrail" {
name = local.associated_resource_name
tags = var.tags
}

data "aws_iam_policy_document" "cloudtrail_sns" {
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ variable "transition_to_glacier" {
type = number
}

variable "tags" {
description = "(Optional) A mapping of tags to assign to the resources"
type = map(string)
default = {}
}

0 comments on commit 034ff64

Please sign in to comment.