Page MenuHomePhabricator

D9757.diff
No OneTemporary

D9757.diff

diff --git a/services/terraform/dev/main.tf b/services/terraform/dev/main.tf
--- a/services/terraform/dev/main.tf
+++ b/services/terraform/dev/main.tf
@@ -31,6 +31,7 @@
dynamic "endpoints" {
for_each = local.aws_settings.override_endpoint[*]
content {
+ opensearch = endpoints.value
dynamodb = endpoints.value
s3 = endpoints.value
secretsmanager = endpoints.value
@@ -44,4 +45,5 @@
module "shared" {
source = "../modules/shared"
is_dev = true
+ vpc = null
}
diff --git a/services/terraform/modules/shared/opensearch.tf b/services/terraform/modules/shared/opensearch.tf
new file mode 100644
--- /dev/null
+++ b/services/terraform/modules/shared/opensearch.tf
@@ -0,0 +1,52 @@
+variable "vpc" {}
+
+variable "domain" {
+ default = "identity-search-domain"
+}
+variable subnet_ids {
+ default = []
+}
+
+data "aws_vpc" "identity-search" {
+ count = var.is_dev ? 0 : 1
+ tags = {
+ Name = var.vpc
+ }
+}
+
+resource "aws_security_group" "identity-search" {
+ count = var.is_dev ? 0 : 1
+ name = "${var.vpc}-opensearch-${var.domain}"
+ description = "Managed by Terraform"
+ vpc_id = var.is_dev ? null : data.aws_vpc.identity-search[count.index].id
+
+ ingress {
+ from_port = 443
+ to_port = 443
+ protocol = "tcp"
+
+ cidr_blocks = [
+ data.aws_vpc.identity-search[count.index].cidr_block,
+ ]
+ }
+}
+
+resource "aws_opensearch_domain" "identity-search" {
+ domain_name = var.domain
+ engine_version = "OpenSearch_1.0"
+
+ cluster_config {
+ instance_type = "m3.medium.search"
+ zone_awareness_enabled = true
+ }
+
+ vpc_options {
+ subnet_ids = var.subnet_ids
+
+ security_group_ids = var.is_dev ? [] : [aws_security_group.identity-search[0].id]
+ }
+
+ advanced_options = {
+ "rest.action.multi.allow_explicit_index" = "true"
+ }
+}

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 1, 10:45 AM (21 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2604788
Default Alt Text
D9757.diff (1 KB)

Event Timeline