From 1dfb5e154cccb1676d4f3785dfe1ed60b68013ae Mon Sep 17 00:00:00 2001 From: Andrew Pearce Date: Tue, 5 Nov 2024 10:06:20 +0000 Subject: [PATCH] use module output for opensearch vpc endpoint --- terraform/account/opensearch.tf | 9 +-------- terraform/account/region/outputs.tf | 4 ++++ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/terraform/account/opensearch.tf b/terraform/account/opensearch.tf index 66dd5a7775..c1327de7e7 100644 --- a/terraform/account/opensearch.tf +++ b/terraform/account/opensearch.tf @@ -1,10 +1,3 @@ -data "aws_vpc_endpoint" "opensearch" { - tags = { - Name = "opensearch" - } - provider = aws.eu_west_1 -} - resource "aws_opensearchserverless_security_policy" "lpas_collection_encryption_policy" { name = "policy-shared-${local.account_name}" type = "encryption" @@ -44,7 +37,7 @@ resource "aws_opensearchserverless_security_policy" "lpas_collection_network_pol ], AllowFromPublic = false, SourceVPCEs = [ - data.aws_vpc_endpoint.opensearch.id + module.eu_west_1[0].opensearch_lpas_collection_vpc_endpoint.id, ] }, { diff --git a/terraform/account/region/outputs.tf b/terraform/account/region/outputs.tf index 4dfd2a35b7..410a025bdf 100644 --- a/terraform/account/region/outputs.tf +++ b/terraform/account/region/outputs.tf @@ -1,3 +1,7 @@ output "ecs_autoscaling_alarm_sns_topic" { value = aws_sns_topic.ecs_autoscaling_alarms } + +output "opensearch_lpas_collection_vpc_endpoint" { + value = aws_opensearchserverless_vpc_endpoint.lpas_collection_vpc_endpoint +}