hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.78k stars 9.13k forks source link

aws_elasticsearch_domain creates multiple NICs even with 1 node #12316

Open bbuivn opened 4 years ago

bbuivn commented 4 years ago

Community Note

Terraform Version

Affected Resource(s)

Terraform Configuration Files

https://gist.github.com/bbuivn/89dd3607717dd73d2f6d8e5c82e96e81#file-es_domain-tf

Debug Output

encrypted plan tf_log encrypted apply tf_log encrypted destroy tf_log

Expected Behavior

1 NIC should be created and in-use.

Actual Behavior

It appears that when creating an Elasticsearch Domain, multiple (3 as far as I have seen) NICs are created. Even with only one node in the cluster and with zone_awareness_enabled = false. Only 1 out of 3 NICs is in-use the other 2 are in available status.

---------------------------------------------------------------------------------------------------------------------------------------------
|                                                         DescribeNetworkInterfaces                                                         |
+-----------------------+---------------------------------------------------+------------------------+-------+----------------+-------------+
|  eni-REDACTED|  ES cluster-es-sandbox                            |  vpc-REDACTED |  None |  10.115.221.61 |  available  |
|  eni-REDACTED|  Interface for NAT Gateway nat-04f2b684f48bd6875  |  vpc-REDACTED |  None |  10.115.101.19 |  in-use     |
|  eni-REDACTED|  Primary network interface                        |  vpc-REDACTED |  None |  10.115.101.13 |  in-use     |
|  eni-REDACTED|  ES cluster-es-sandbox                            |  vpc-REDACTED |  None |  10.115.221.17 |  available  |
|  eni-REDACTED|  ES cluster-es-sandbox                            |  vpc-REDACTED |  None |  10.115.221.45 |  in-use     |
+-----------------------+---------------------------------------------------+------------------------+-------+----------------+-------------+

Steps to Reproduce

  1. terraform apply

Important Factoids

None

References

justinretzolk commented 3 years ago

Hey @bbuivn šŸ‘‹ Thank you for taking the time to file this issue. Given that there's been a number of AWS Provider releases since you initially filed it, can you confirm whether you're still experiencing this behavior?

ljluestc commented 3 weeks ago

provider "aws" {
  region = "us-west-2" # Change to your desired region
}

resource "aws_elasticsearch_domain" "example" {
  domain_name = "example-domain"

  elasticsearch_version = "7.10"

  cluster_config {
    instance_type = "t2.small.elasticsearch"
    instance_count = 1
    zone_awareness_enabled = false # Ensure this is set to false
  }

  vpc_options {
    subnet_ids = ["subnet-REDACTED"] # Replace with your subnet ID
    security_group_ids = ["sg-REDACTED"] # Replace with your security group ID
  }

  tags = {
    Name = "example-domain"
  }
}

output "domain_endpoint" {
  value = aws_elasticsearch_domain.example.endpoint
}