Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log_publishing_options has to be a list #35

Open
r-divakaran-hrs opened this issue Jul 26, 2019 · 1 comment
Open

log_publishing_options has to be a list #35

r-divakaran-hrs opened this issue Jul 26, 2019 · 1 comment

Comments

@r-divakaran-hrs
Copy link

r-divakaran-hrs commented Jul 26, 2019

Hello,

I am using terraform version 0.11.4 and using v0.8.0 of this module to create a elastic search domain.

The module is like this

module "es" {
  source                         = "git::https://github.com/terraform-community-modules/tf_aws_elasticsearch.git?ref=v0.8.0"
  domain_name                    = "${var.domain_name_prefix}-${var.environment}"
  use_prefix                     = "false"
  es_version                     = "${var.es_version}"
  create_iam_service_linked_role = "${var.create_es_service_linked_role}"
  vpc_options                    = {
    security_group_ids = ["${aws_security_group.es_domain_security_group.id}"]
    subnet_ids         = ["${var.aws_subnet_ids}"]
  }
  instance_count                 = "${var.instance_count}"
  instance_type                  = "${var.instance_type}"
  es_zone_awareness              = "${var.es_zone_awareness}"
  ebs_volume_size                = "${var.ebs_volume_size}"

  tags                           = "${merge(var.tags, var.additional_tags)}"

  advanced_options = {
    "rest.action.multi.allow_explicit_index" = "true"   # double quotes are required here
  }

  log_publishing_options = [
    {
      cloudwatch_log_group_arn = "${aws_cloudwatch_log_group.elasticsearch.arn}"
      log_type                 = "INDEX_SLOW_LOGS"
      enabled                  = true
    },
    {
      cloudwatch_log_group_arn = "${aws_cloudwatch_log_group.elasticsearch.arn}"
      log_type                 = "SEARCH_SLOW_LOGS"
      enabled                  = true
    },
    {
      cloudwatch_log_group_arn = "${aws_cloudwatch_log_group.elasticsearch.arn}"
      log_type                 = "ES_APPLICATION_LOGS"
      enabled                  = true
    }
  ]
}

While trying to create the domain it giving below error

Error: module.logs-elk.module.es.aws_elasticsearch_domain.es: log_publishing_options: should be a list



Error: module.logs-elk.module.es.aws_elasticsearch_domain.es_vpc: log_publishing_options: should be a list

Any help will be greatly appreciated.

Thanks

@drein99
Copy link

drein99 commented Dec 1, 2022

To anyone else stumbling upon this issue: You can define multiple log_publishing_options for one OpenSearch Cluster:

resource "aws_cloudwatch_log_group" "application-logs" {
  name = "/aws/OpenSearchService/domains/${var.domain_name}/ApplicationLogs"
}

resource "aws_cloudwatch_log_group" "index-slow-logs" {
  name = "/aws/OpenSearchService/domains/${var.domain_name}/IndexSlowLogs"
}

resource "aws_cloudwatch_log_group" "search-slow-logs" {
  name = "/aws/OpenSearchService/domains/${var.domain_name}/SearchSlowLogs"
}

resource "aws_cloudwatch_log_group" "audit-logs" {
  name = "/aws/OpenSearchService/domains/${var.domain_name}/AuditLogs"
}

resource "aws_opensearch_domain" "example" {

...

  log_publishing_options {
    cloudwatch_log_group_arn = aws_cloudwatch_log_group.application-logs.arn
    log_type                 = "ES_APPLICATION_LOGS"
  }

  log_publishing_options {
    cloudwatch_log_group_arn = aws_cloudwatch_log_group.index-slow-logs.arn
    log_type                 = "INDEX_SLOW_LOGS"
  }

  log_publishing_options {
    cloudwatch_log_group_arn = aws_cloudwatch_log_group.search-slow-logs.arn
    log_type                 = "SEARCH_SLOW_LOGS"
  }

  log_publishing_options {
    cloudwatch_log_group_arn = aws_cloudwatch_log_group.audit-logs.arn
    log_type                 = "AUDIT_LOGS"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants