lgallard/terraform-aws-elasticsearch

Add vpc_id to vpc_options

sethcenterbar opened this issue · 2 comments

I'm relatively new to implementing custom terraform modules, so forgive me if I'm missing something here.

I'm attempting to use this module to create an elasticsearch cluster in a particular vpc (we have multiple within an account). When I run a plan, I see that it should be associating a vpc with the elasticsearch cluster.

image

When I look at the options taken by this module, however, vpc_id is not one. I looked at your main.tf, and can see that it's simply not being looked for in in the code.

# vpc_options
  dynamic "vpc_options" {
    for_each = local.vpc_options
    content {
      security_group_ids = lookup(vpc_options.value, "security_group_ids")
      subnet_ids         = lookup(vpc_options.value, "subnet_ids")
    }
  }

Is this a relatively simple update to the code, or am I overlooking something that would allow me to do this without changing your module?

Thanks!

@sethcenterbar when you set the subnet_ids list you are defining the VPC implicitly. You can check that the vpc_options block doesn't expect a vpc id parameter in the aws_elasticsearch_domain resource documentation https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticsearch_domain#subnet_ids.

@sethcenterbar I'm closing the issue because your doubt was cleared. Regrads!