Skip to content

Commit

Permalink
workon kms
Browse files Browse the repository at this point in the history
  • Loading branch information
coilysiren committed Oct 10, 2024
1 parent bc5aea0 commit 303dfe6
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions infra/modules/search/authentication.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ resource "aws_kms_key" "opensearch" {
}
},
{
Sid = "Allow access to AWS managed services",
Sid = "Allow access to AWS OpenSearch",
Principal = {
Service = "es.${data.aws_region.current.name}.amazonaws.com"
},
Effect = "Allow",
Action = [
"kms:List*",
Expand All @@ -87,16 +90,6 @@ resource "aws_kms_key" "opensearch" {
"kms:GenerateDataKey*"
],
Resource = "*",
Condition = {
"ForAnyValue:StringLike" = {
# The service we are granting access to is OpenSearch, which is somtimes denoted as "os" in AWS.
# And other times as "es" (for "ElasticSearch"). So we just allow both, to be safe.
"kms:ViaService" : [
"os.${data.aws_region.current.name}.amazonaws.com",
"es.${data.aws_region.current.name}.amazonaws.com"
]
},
}
},
]
})
Expand Down

0 comments on commit 303dfe6

Please sign in to comment.