Skip to content

Commit

Permalink
fix: Correct tflint errors for latest version of tflint (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryantbiggs authored Oct 26, 2022
1 parent 2f53f61 commit b40ade4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
4 changes: 2 additions & 2 deletions modules/iam-assumable-role-with-oidc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ resource "aws_iam_role" "this" {
force_detach_policies = var.force_detach_policies
permissions_boundary = var.role_permissions_boundary_arn

assume_role_policy = join("", data.aws_iam_policy_document.assume_role_with_oidc.*.json)
assume_role_policy = data.aws_iam_policy_document.assume_role_with_oidc[0].json

tags = var.tags
}

resource "aws_iam_role_policy_attachment" "custom" {
count = var.create_role ? local.number_of_role_policy_arns : 0

role = join("", aws_iam_role.this.*.name)
role = aws_iam_role.this[0].name
policy_arn = var.role_policy_arns[count.index]
}
2 changes: 1 addition & 1 deletion modules/iam-assumable-role-with-saml/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ resource "aws_iam_role" "this" {
resource "aws_iam_role_policy_attachment" "custom" {
count = var.create_role ? local.number_of_role_policy_arns : 0

role = join("", aws_iam_role.this.*.name)
role = aws_iam_role.this[0].name
policy_arn = var.role_policy_arns[count.index]
}
4 changes: 2 additions & 2 deletions modules/iam-group-with-policies/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
locals {
group_name = element(concat(aws_iam_group.this.*.id, [var.name]), 0)
group_name = var.create_group ? aws_iam_group.this[0].id : var.name
}

resource "aws_iam_group" "this" {
Expand Down Expand Up @@ -37,7 +37,7 @@ resource "aws_iam_group_policy_attachment" "custom" {
count = length(var.custom_group_policies)

group = local.group_name
policy_arn = element(aws_iam_policy.custom.*.arn, count.index)
policy_arn = element(aws_iam_policy.custom[*].arn, count.index)
}

###############
Expand Down
8 changes: 1 addition & 7 deletions modules/iam-group-with-policies/policies.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ data "aws_caller_identity" "current" {
data "aws_partition" "current" {}

locals {
aws_account_id = element(
concat(
data.aws_caller_identity.current.*.account_id,
[var.aws_account_id],
),
0,
)
aws_account_id = try(data.aws_caller_identity.current[0].account_id, var.aws_account_id)
}

data "aws_iam_policy_document" "iam_self_management" {
Expand Down
6 changes: 3 additions & 3 deletions modules/iam-read-only-policy/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ data "aws_iam_policy_document" "logs_query" {
data "aws_iam_policy_document" "combined" {
source_policy_documents = concat(
[data.aws_iam_policy_document.allowed_services.json],
data.aws_iam_policy_document.console_services.*.json,
data.aws_iam_policy_document.sts.*.json,
data.aws_iam_policy_document.logs_query.*.json,
data.aws_iam_policy_document.console_services[*].json,
data.aws_iam_policy_document.sts[*].json,
data.aws_iam_policy_document.logs_query[*].json,
[var.additional_policy_json]
)
}

0 comments on commit b40ade4

Please sign in to comment.