Skip to content

Commit 5c6f7be

Browse files
feat(opensearch): FTRS-856 Index creation and population
1 parent 04e8280 commit 5c6f7be

File tree

3 files changed

+20
-53
lines changed

3 files changed

+20
-53
lines changed

infrastructure/stacks/opensearch/opensearch_collection_policy.tf

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ resource "aws_opensearchserverless_access_policy" "opensearch_serverless_data_ac
6565
])
6666
}
6767

68+
// NOTE: Collection and dashboards are currently public (AllowFromPublic = true) for ease of testing.
69+
// To make the collection private later, create VPCE(s) in the account-wide stack and supply their IDs
70+
// to this stack, then set AllowFromPublic = false and set SourceVPCEs.
71+
6872
resource "aws_opensearchserverless_security_policy" "opensearch_serverless_workspace_network_access_policy" {
6973
count = local.workspace_suffix == "" ? 0 : 1
7074
name = "${var.environment}-${var.stack_name}${local.workspace_suffix}-nap"
@@ -84,9 +88,7 @@ resource "aws_opensearchserverless_security_policy" "opensearch_serverless_works
8488
},
8589
{
8690
Description = "Workspace network access for collection"
87-
AllowFromPublic = false
88-
SourceVPCEs = []
89-
SourceServices = []
91+
AllowFromPublic = true
9092
Rules = [
9193
{
9294
Resource = ["collection/${data.aws_opensearchserverless_collection.opensearch_serverless_collection.name}"]
@@ -98,10 +100,11 @@ resource "aws_opensearchserverless_security_policy" "opensearch_serverless_works
98100
}
99101

100102
resource "aws_opensearchserverless_access_policy" "opensearch_serverless_workspace_data_access_policy" {
101-
count = local.workspace_suffix == "" ? 0 : 1
103+
count = local.workspace_suffix == "" ? 0 : 1
104+
102105
name = "${var.environment}-${var.stack_name}${local.workspace_suffix}-dap"
103106
type = "data"
104-
description = "Workspace-level data access for collection (allows ingestion by pipeline/runner)"
107+
description = "Collection-level data access policy for OpenSearch collection ${local.opensearch_collection_name} (grants collection & index ops)"
105108

106109
policy = jsonencode([
107110
{
@@ -115,6 +118,18 @@ resource "aws_opensearchserverless_access_policy" "opensearch_serverless_workspa
115118
"aoss:DescribeCollectionItems",
116119
"aoss:DeleteCollectionItems"
117120
]
121+
},
122+
{
123+
ResourceType = "index"
124+
Resource = ["index/${data.aws_opensearchserverless_collection.opensearch_serverless_collection.name}/${local.opensearch_index_name}${local.workspace_suffix}"]
125+
Permission = [
126+
"aoss:CreateIndex",
127+
"aoss:UpdateIndex",
128+
"aoss:DescribeIndex",
129+
"aoss:DeleteIndex",
130+
"aoss:ReadDocument",
131+
"aoss:WriteDocument"
132+
]
118133
}
119134
],
120135
Principal = concat(

infrastructure/stacks/opensearch/opensearch_index_policies.tf

Lines changed: 0 additions & 43 deletions
This file was deleted.

infrastructure/stacks/opensearch/variables.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,3 @@ variable "opensearch_pipeline_s3_dlq_prefix" {
5858
type = string
5959
}
6060

61-
variable "include_github_runner_principal" {
62-
description = "Whether to include the GitHub runner role ARN in access policy Principals"
63-
type = bool
64-
default = false
65-
}

0 commit comments

Comments
 (0)