Skip to content

Commit

Permalink
add frozen_solid/aws-opensearchserverless-is-public.tf
Browse files Browse the repository at this point in the history
  • Loading branch information
frozenSolid authored and semgrep-bot committed Sep 27, 2023
1 parent b368e13 commit 2f96865
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions frozen_solid/aws-opensearchserverless-is-public.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
resource "aws_opensearchserverless_security_policy" "example" {
name = "example"
type = "network"
description = "Mixed access for marketing and sales"
policy = jsonencode([
{
"Description" : "Marketing access",
"Rules" : [
{
"ResourceType" : "collection",
"Resource" : [
"collection/marketing*"
]
},
{
"ResourceType" : "dashboard",
"Resource" : [
"collection/marketing*"
]
}
],
"AllowFromPublic" : false,
"SourceVPCEs" : [
"vpce-050f79086ee71ac05"
]
},
# ruleid: aws-opensearchserverless-is-public
{
"Description" : "Sales access",
"Rules" : [
{
"ResourceType" : "collection",
"Resource" : [
"collection/finance"
]
}
],
"AllowFromPublic" : true
}
])
}

resource "aws_opensearchserverless_security_policy" "pass" {
name = "example"
type = "network"
description = "VPC access"
policy = jsonencode(
{
Description = "VPC access to collection and Dashboards endpoint for example collection",
Rules = [
{
ResourceType = "collection",
Resource = [
"collection/example-collection"
]
},
{
ResourceType = "dashboard"
Resource = [
"collection/example-collection"
]
}
],
# ok: aws-opensearchserverless-is-public
AllowFromPublic = false,
SourceVPCEs = [
"vpce-050f79086ee71ac05"
]
}
)
}

resource "aws_opensearchserverless_security_policy" "fail_2_heredoc" {
name = "fail_2_heredoc"
type = "network"
description = "public access"
# ruleid: aws-opensearchserverless-is-public
policy = <<POLICY
{
"Rules": [
{
"Resource": [
"collection/example-collection"
],
"ResourceType": "collection"
},
{
"Resource": [
"collection/example-collection"
],
"ResourceType": "dashboard"
}
],
"AllowFromPublic": true
}
POLICY
}

0 comments on commit 2f96865

Please sign in to comment.