Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added Name tag for IAM policies and roles #62

Merged
merged 3 commits into from
Sep 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ resource "aws_iam_role" "eventbridge" {
permissions_boundary = var.role_permissions_boundary
assume_role_policy = data.aws_iam_policy_document.assume_role[0].json

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

#####################
Expand All @@ -56,6 +56,8 @@ resource "aws_iam_policy" "tracing" {

name = "${local.role_name}-tracing"
policy = data.aws_iam_policy.tracing[0].policy

tags = merge({ Name = "${local.role_name}-tracing" }, var.tags)
}

resource "aws_iam_policy_attachment" "tracing" {
Expand Down Expand Up @@ -86,6 +88,8 @@ resource "aws_iam_policy" "kinesis" {

name = "${local.role_name}-kinesis"
policy = data.aws_iam_policy_document.kinesis[0].json

tags = merge({ Name = "${local.role_name}-kinesis" }, var.tags)
}

resource "aws_iam_policy_attachment" "kinesis" {
Expand Down Expand Up @@ -116,6 +120,8 @@ resource "aws_iam_policy" "kinesis_firehose" {

name = "${local.role_name}-kinesis-firehose"
policy = data.aws_iam_policy_document.kinesis_firehose[0].json

tags = merge({ Name = "${local.role_name}-kinesis-firehose" }, var.tags)
}

resource "aws_iam_policy_attachment" "kinesis_firehose" {
Expand Down Expand Up @@ -150,6 +156,8 @@ resource "aws_iam_policy" "sqs" {

name = "${local.role_name}-sqs"
policy = data.aws_iam_policy_document.sqs[0].json

tags = merge({ Name = "${local.role_name}-sqs" }, var.tags)
}

resource "aws_iam_policy_attachment" "sqs" {
Expand Down Expand Up @@ -187,6 +195,8 @@ resource "aws_iam_policy" "ecs" {

name = "${local.role_name}-ecs"
policy = data.aws_iam_policy_document.ecs[0].json

tags = merge({ Name = "${local.role_name}-ecs" }, var.tags)
}

resource "aws_iam_policy_attachment" "ecs" {
Expand Down Expand Up @@ -217,6 +227,8 @@ resource "aws_iam_policy" "lambda" {

name = "${local.role_name}-lambda"
policy = data.aws_iam_policy_document.lambda[0].json

tags = merge({ Name = "${local.role_name}-lambda" }, var.tags)
}

resource "aws_iam_policy_attachment" "lambda" {
Expand Down Expand Up @@ -247,6 +259,8 @@ resource "aws_iam_policy" "sfn" {

name = "${local.role_name}-sfn"
policy = data.aws_iam_policy_document.sfn[0].json

tags = merge({ Name = "${local.role_name}-sfn" }, var.tags)
}

resource "aws_iam_policy_attachment" "sfn" {
Expand Down Expand Up @@ -277,6 +291,8 @@ resource "aws_iam_policy" "api_destination" {

name = "${local.role_name}-api-destination"
policy = data.aws_iam_policy_document.api_destination[0].json

tags = merge({ Name = "${local.role_name}-api-destination" }, var.tags)
}

resource "aws_iam_policy_attachment" "api_destination" {
Expand Down Expand Up @@ -311,6 +327,8 @@ resource "aws_iam_policy" "cloudwatch" {

name = "${local.role_name}-cloudwatch"
policy = data.aws_iam_policy_document.cloudwatch[0].json

tags = merge({ Name = "${local.role_name}-cloudwatch" }, var.tags)
}

resource "aws_iam_policy_attachment" "cloudwatch" {
Expand All @@ -331,6 +349,8 @@ resource "aws_iam_policy" "additional_json" {
name = local.role_name
path = var.role_path
policy = var.policy_json

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

resource "aws_iam_policy_attachment" "additional_json" {
Expand All @@ -350,6 +370,8 @@ resource "aws_iam_policy" "additional_jsons" {

name = "${local.role_name}-${count.index}"
policy = var.policy_jsons[count.index]

tags = merge({ Name = "${local.role_name}-${count.index}" }, var.tags)
}

resource "aws_iam_policy_attachment" "additional_jsons" {
Expand Down Expand Up @@ -433,6 +455,8 @@ resource "aws_iam_policy" "additional_inline" {

name = "${local.role_name}-inline"
policy = data.aws_iam_policy_document.additional_inline[0].json

tags = merge({ Name = "${local.role_name}-inline" }, var.tags)
}

resource "aws_iam_policy_attachment" "additional_inline" {
Expand Down