Skip to content

Commit 52c6274

Browse files
author
marcin
authored
Allow unauthenticated access to ES from whitelisted IPs (#58)
1 parent 9714e00 commit 52c6274

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

main.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,20 @@ data "aws_iam_policy_document" "default" {
221221
type = "AWS"
222222
identifiers = distinct(compact(concat(var.iam_role_arns, aws_iam_role.elasticsearch_user.*.arn)))
223223
}
224+
225+
# This condition is for non VPC ES to allow anonymous access from whitelisted IP ranges without requests signing
226+
# https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-ac.html#es-ac-types-ip
227+
# https://aws.amazon.com/premiumsupport/knowledge-center/anonymous-not-authorized-elasticsearch/
228+
dynamic "condition" {
229+
for_each = ! var.vpc_enabled && length(var.allowed_cidr_blocks) > 0 ? [true] : []
230+
231+
content {
232+
test = "IpAddress"
233+
values = var.allowed_cidr_blocks
234+
variable = "aws:SourceIp"
235+
}
236+
}
237+
224238
}
225239
}
226240

0 commit comments

Comments
 (0)