Skip to content

Commit

Permalink
fix(DMVP-4760): Add policy attachment support
Browse files Browse the repository at this point in the history
  • Loading branch information
SarhadMeta committed Sep 23, 2024
1 parent 4a03aad commit 87857fe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ module "bucket" {

website = var.website

policy = local.is_public ? data.aws_iam_policy_document.public[0].json : ""
attach_policy = local.is_public
policy = local.is_public ? data.aws_iam_policy_document.public[0].json : var.policy
attach_policy = local.is_public || var.attach_policy // To Do: Add support for merging two policies
}

// have initial index.html file content
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,15 @@ variable "event_notification_config" {
events = ["s3:ObjectCreated:*"]
}
}

variable "policy" {
description = "Bucket policies to be attached to the bucket in case custom policies are needed for the bucket"
type = any
default = "" # Default case is empty, to be compatibile with the previous behavior
}

variable "attach_policy" {
description = "Flag to control if the policy should be attached to the bucket"
type = bool
default = false
}

0 comments on commit 87857fe

Please sign in to comment.