FIX: flowlog role and policy name change

This commit is contained in:
xpk 2023-07-13 07:48:49 +08:00
parent c6f160c918
commit 897f0e2d6a
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86

View File

@ -18,8 +18,12 @@ resource "aws_cloudwatch_log_group" "vpcflowlog-loggroup" {
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
{ {
@ -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