Skip to content

Commit

Permalink
removed references to var.domain_name
Browse files Browse the repository at this point in the history
  • Loading branch information
colemandevries committed Jan 25, 2024
1 parent 6de81b8 commit 8d9eae8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module "opensearch" {
source = "../.."


attach_permissions_boundary = true
cluster_tshirt_size = "md"
engine_version = "OpenSearch_2.11"
Expand Down
18 changes: 9 additions & 9 deletions terraform/modules/opensearch/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ resource "aws_opensearch_domain" "this" {
resource "aws_security_group" "this" {
count = var.create_security_group ? 1 : 0

name = "${var.domain_name}-security-group"
description = "The security group for the ${var.domain_name} OpenSearch domain"
name = "${var.resource_prefix}-opensearch-security-group"
description = "The security group for the ${var.resource_prefix}-opensearch OpenSearch domain"
vpc_id = var.vpc_id

tags = {
Name = "${var.domain_name}-security-group"
Name = "${var.resource_prefix}-opensearch-security-group"
}
}

Expand All @@ -100,23 +100,23 @@ resource "aws_security_group_rule" "this" {
resource "aws_cloudwatch_log_group" "this" {
count = length(var.log_types) > 0 ? 1 : 0

name = "/aws/opensearch-service/${var.domain_name}"
name = "/aws/opensearch-service/${var.resource_prefix}"
retention_in_days = var.log_retention_in_days
tags = var.tags
}

resource "aws_cloudwatch_log_resource_policy" "this" {
count = var.create_cloudwatch_log_policy ? 1 : 0

policy_name = "${var.domain_name}-log-policy"
policy_name = "${var.resource_prefix}-opensearch-log-policy"
policy_document = data.aws_iam_policy_document.logs.json
}

resource "aws_iam_role" "snapshot" {
count = var.create_snapshot_role ? 1 : 0

name = "${var.iam_prefix}-${var.domain_name}-snapshot-role"
description = "The snapshot role for the ${var.domain_name} OpenSearch domain"
name = "${var.iam_prefix}-${var.resource_prefix}-opensearch-snapshot-role"
description = "The snapshot role for the ${var.resource_prefix}-opensearch domain"
assume_role_policy = data.aws_iam_policy_document.trust[0].json
permissions_boundary = local.permissions_boundary
tags = var.tags
Expand All @@ -125,8 +125,8 @@ resource "aws_iam_role" "snapshot" {
resource "aws_iam_policy" "snapshot" {
count = var.create_snapshot_role ? 1 : 0

name = "${var.iam_prefix}-${var.domain_name}-snapshot-policy"
description = "The snapshot policy for the ${var.domain_name} OpenSearch domain"
name = "${var.iam_prefix}-${var.resource_prefix}-opensearch-snapshot-policy"
description = "The snapshot policy for the ${var.resource_prefix}-opensearch domain"
policy = data.aws_iam_policy_document.snapshot[0].json
}

Expand Down
6 changes: 0 additions & 6 deletions terraform/modules/opensearch/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,6 @@ variable "dedicated_master_type" {
sensitive = false
}

variable "domain_name" {
type = string
description = "The name of the OpenSearch domain"
sensitive = false
}

variable "encrypt_at_rest" {
type = bool
description = "Whether to enable encryption at rest for the domain"
Expand Down

0 comments on commit 8d9eae8

Please sign in to comment.