Skip to content

Commit

Permalink
v1.1.6: add tags to resources
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Jul 14, 2021
1 parent 76638b2 commit b11720d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@
* v1.1.5 -- 20210712
- flowlogs
- change template input name

* v1.1.6 -- 20210714
- flowlogs
- add tags to resources
2 changes: 1 addition & 1 deletion common/version.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
locals {
_module_version = "1.1.5"
_module_version = "1.1.6"
}
25 changes: 25 additions & 0 deletions flowlogs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ resource "aws_flow_log" "flowlog_public" {
iam_role_arn = var.flowlog_role_arn
traffic_type = "ALL"
subnet_id = each.key

tags = merge(
local.base_tags,
var.tags,
tomap({ "Name" = format("%v:%v-%v", "s3", var.vpc_full_name, "public") }),
)
}

# whole VPC
Expand All @@ -76,27 +82,46 @@ resource "aws_flow_log" "flowlog" {
iam_role_arn = var.flowlog_role_arn
traffic_type = "ALL"
vpc_id = var.vpc_id

tags = merge(
local.base_tags,
var.tags,
tomap({ "Name" = format("%v:%v", "s3", var.vpc_full_name) }),
)
}

#---
# flowlog, cloudwatch
#---
resource "aws_cloudwatch_log_group" "flowlog" {
name = format("%v%v", local._prefixes["log-group"], var.vpc_full_name)

tags = merge(
local.base_tags,
var.tags,
tomap({ "Name" = format("%v-%v:%v", "cloudwatch", "log-group", var.vpc_full_name) }),
)
}

resource "aws_flow_log" "flowlog_cloudwatch" {
log_destination = aws_cloudwatch_log_group.flowlog.arn
iam_role_arn = var.flowlog_role_arn
traffic_type = "ALL"
vpc_id = var.vpc_id

tags = merge(
local.base_tags,
var.tags,
tomap({ "Name" = format("%v:%v", "cloudwatch", var.vpc_full_name) }),
)
}

resource "aws_kinesis_stream" "flowlog" {
name = local.flowlog_stream_name
shard_count = 1
retention_period = 48
shard_level_metrics = ["IncomingBytes", "OutgoingBytes", "IncomingRecords", "OutgoingRecords"]

tags = merge(
local.base_tags,
var.tags,
Expand Down

0 comments on commit b11720d

Please sign in to comment.