Skip to content

Commit 1d6e764

Browse files
author
Sébastien Rouaix
committed
fix: add region for subnets recovery
1 parent 2bbb79b commit 1d6e764

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ No modules.
176176
| [aws_iam_policy_document.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
177177
| [aws_iam_session_context.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_session_context) | data source |
178178
| [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source |
179-
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
180179
| [aws_subnet.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet) | data source |
181180

182181
## Inputs

main.tf

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
data "aws_region" "current" {
2-
count = var.create ? 1 : 0
3-
}
41
data "aws_partition" "current" {
52
count = var.create ? 1 : 0
63
}
@@ -15,9 +12,8 @@ data "aws_iam_session_context" "current" {
1512
locals {
1613
account_id = try(data.aws_caller_identity.current[0].account_id, "")
1714
partition = try(data.aws_partition.current[0].partition, "")
18-
region = try(data.aws_region.current[0].region, "")
1915

20-
static_domain_arn = "arn:${local.partition}:es:${local.region}:${local.account_id}:domain/${var.domain_name}"
16+
static_domain_arn = "arn:${local.partition}:es:${var.region}:${local.account_id}:domain/${var.domain_name}"
2117

2218
tags = merge(var.tags, { terraform-aws-modules = "opensearch" })
2319
}
@@ -409,7 +405,7 @@ resource "aws_opensearch_outbound_connection" "this" {
409405

410406
local_domain_info {
411407
owner_id = try(each.value.local_domain_info.owner_id, local.account_id)
412-
region = try(each.value.local_domain_info.region, local.region)
408+
region = try(each.value.local_domain_info.region, var.region)
413409
domain_name = try(each.value.local_domain_info.domain_name, aws_opensearch_domain.this[0].domain_name)
414410
}
415411

@@ -494,7 +490,8 @@ locals {
494490
data "aws_subnet" "this" {
495491
count = local.create_security_group ? 1 : 0
496492

497-
id = element(var.vpc_options.subnet_ids, 0)
493+
region = var.region
494+
id = element(var.vpc_options.subnet_ids, 0)
498495
}
499496

500497
resource "aws_security_group" "this" {

0 commit comments

Comments
 (0)