Skip to content

Commit

Permalink
OPS-6322 More strict access policy for S3 data source (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
snovikov authored Nov 8, 2024
1 parent b5303c9 commit 837e80e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ data "aws_iam_policy_document" "knowledgebase_permissions" {
}
statement {
actions = ["s3:GetObject"]
resources = [
resources = var.s3_configuration.inclusion_prefixes == null ? [
"${var.s3_configuration.bucket_arn}/*"
] : [for prefix in var.s3_configuration.inclusion_prefixes :
"${var.s3_configuration.bucket_arn}/${prefix}*"
]
condition {
test = "StringEquals"
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ variable "s3_configuration" {
bucket_owner_account_id = optional(string)
inclusion_prefixes = optional(set(string))
})

validation {
condition = var.s3_configuration.inclusion_prefixes == null ? true : length(var.s3_configuration.inclusion_prefixes) == 1
error_message = "For now s3 data source support only one prefix."
}
}

variable "oss_collection_name" {
Expand Down

0 comments on commit 837e80e

Please sign in to comment.