FIX: flowlog role and policy name change
This commit is contained in:
parent
c6f160c918
commit
897f0e2d6a
@ -1,9 +1,9 @@
|
|||||||
resource "aws_flow_log" "vpc-flowlog" {
|
resource "aws_flow_log" "vpc-flowlog" {
|
||||||
count = var.enable-flow-log ? 1 : 0
|
count = var.enable-flow-log ? 1 : 0
|
||||||
iam_role_arn = aws_iam_role.vpcflowlog-role.arn
|
iam_role_arn = aws_iam_role.vpcflowlog-role.arn
|
||||||
log_destination = aws_cloudwatch_log_group.vpcflowlog-loggroup[0].arn
|
log_destination = aws_cloudwatch_log_group.vpcflowlog-loggroup[0].arn
|
||||||
traffic_type = "ALL"
|
traffic_type = "ALL"
|
||||||
vpc_id = aws_vpc.vpc.id
|
vpc_id = aws_vpc.vpc.id
|
||||||
tags = {
|
tags = {
|
||||||
Name = "${var.resource-prefix}-vpcflowlog"
|
Name = "${var.resource-prefix}-vpcflowlog"
|
||||||
}
|
}
|
||||||
@ -13,14 +13,18 @@ resource "aws_cloudwatch_log_group" "vpcflowlog-loggroup" {
|
|||||||
count = var.enable-flow-log ? 1 : 0
|
count = var.enable-flow-log ? 1 : 0
|
||||||
|
|
||||||
name_prefix = "vpcflowlog/${aws_vpc.vpc.id}/"
|
name_prefix = "vpcflowlog/${aws_vpc.vpc.id}/"
|
||||||
kms_key_id = var.vpcflowlog-cwl-loggroup-key-arn
|
kms_key_id = var.vpcflowlog-cwl-loggroup-key-arn
|
||||||
|
|
||||||
retention_in_days = var.vpcflowlog-retain-days
|
retention_in_days = var.vpcflowlog-retain-days
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "random_id" "rid" {
|
||||||
|
byte_length = 2
|
||||||
|
}
|
||||||
|
|
||||||
resource "aws_iam_role" "vpcflowlog-role" {
|
resource "aws_iam_role" "vpcflowlog-role" {
|
||||||
name = "${var.resource-prefix}-vpcflowlog"
|
name = "VpcFlowlogRole-${random_id.rid.dec}"
|
||||||
path = "/service/"
|
path = "/service/"
|
||||||
assume_role_policy = <<EOF
|
assume_role_policy = <<EOF
|
||||||
{
|
{
|
||||||
"Version": "2012-10-17",
|
"Version": "2012-10-17",
|
||||||
@ -39,7 +43,7 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_iam_role_policy" "vpcflowlog-role-policy" {
|
resource "aws_iam_role_policy" "vpcflowlog-role-policy" {
|
||||||
name = "${var.resource-prefix}-vpcflowlog"
|
name = "VpcFlowlogRole-${random_id.rid.dec}"
|
||||||
role = aws_iam_role.vpcflowlog-role.id
|
role = aws_iam_role.vpcflowlog-role.id
|
||||||
|
|
||||||
policy = <<EOF
|
policy = <<EOF
|
||||||
|
Loading…
Reference in New Issue
Block a user