Skip to content

Commit

Permalink
fix: add tags to IAM Policy (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
rajgandhi9 authored Nov 4, 2021
1 parent 2fb0e69 commit ec108f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
locals {
iam_role_arn = module.lacework_cfg_iam_role.created ? module.lacework_cfg_iam_role.arn : var.iam_role_arn
iam_role_name = module.lacework_cfg_iam_role.created ? module.lacework_cfg_iam_role.name : var.iam_role_name
iam_role_external_id = module.lacework_cfg_iam_role.created ? module.lacework_cfg_iam_role.external_id : var.iam_role_external_id
iam_role_arn = module.lacework_cfg_iam_role.created ? module.lacework_cfg_iam_role.arn : var.iam_role_arn
iam_role_name = module.lacework_cfg_iam_role.created ? module.lacework_cfg_iam_role.name : var.iam_role_name
iam_role_external_id = module.lacework_cfg_iam_role.created ? module.lacework_cfg_iam_role.external_id : var.iam_role_external_id
lacework_audit_policy_name = (
length(var.lacework_audit_policy_name) > 0 ? var.lacework_audit_policy_name : "lwaudit-policy-${random_id.uniq.hex}"
)
Expand Down Expand Up @@ -42,6 +42,7 @@ resource "aws_iam_policy" "lacework_audit_policy" {
name = local.lacework_audit_policy_name
description = "An audit policy to allow Lacework to read configs (extends SecurityAudit)"
policy = data.aws_iam_policy_document.lacework_audit_policy.json
tags = var.tags
}

resource "aws_iam_role_policy_attachment" "lacework_audit_policy_attachment" {
Expand All @@ -54,7 +55,7 @@ resource "aws_iam_role_policy_attachment" "lacework_audit_policy_attachment" {
# before trying to create the Lacework external integration
resource "time_sleep" "wait_time" {
create_duration = var.wait_time
depends_on = [
depends_on = [
aws_iam_role_policy_attachment.security_audit_policy_attachment,
aws_iam_role_policy_attachment.lacework_audit_policy_attachment,
]
Expand Down
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ variable "lacework_integration_name" {
}

variable "lacework_audit_policy_name" {
type = string
default = ""
type = string
default = ""
description = "The name of the custom audit policy (which extends SecurityAudit) to allow Lacework to read configs. Defaults to lwaudit-policy-$${random_id.uniq.hex} when empty"
}

Expand Down

0 comments on commit ec108f3

Please sign in to comment.