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

[Bug]: Error: creating EC2 Instance: InvalidNetworkInterface.InUse: Interface: [eni-XXX] in use. #27513

Open
r4f4 opened this issue Oct 27, 2022 · 2 comments
Labels
bug Addresses a defect in current functionality. service/vpc Issues and PRs that pertain to the vpc service.

Comments

@r4f4
Copy link

r4f4 commented Oct 27, 2022

Terraform Core Version

1.0.11

AWS Provider Version

4.34.0

Affected Resource(s)

aws_instance, aws_network_interface

Expected Behavior

Network interface is not in use and the EC2 instance is successfully created.

Actual Behavior

Network interface is created. While the instance that uses that interface is created, an error is thrown saying the interface is in use.

Relevant Error/Panic Output Snippet

time="2022-10-27T13:19:48Z" level=debug msg="  # module.masters.aws_network_interface.master[0] will be created"
...
time="2022-10-27T13:20:15Z" level=debug msg="module.masters.aws_network_interface.master[0]: Creating..."
...
time="2022-10-27T13:20:16Z" level=debug msg="module.masters.aws_network_interface.master[0]: Creation complete after 0s [id=eni-0b02b09699ec55970]"
...
time="2022-10-27T13:20:16Z" level=debug msg="module.masters.aws_instance.master[0]: Creating..."
...
time="2022-10-27T13:43:46Z" level=debug msg="module.masters.aws_instance.master[0]: Still creating... [23m30s elapsed]"
time="2022-10-27T13:43:56Z" level=debug msg="module.masters.aws_instance.master[0]: Still creating... [23m40s elapsed]"
time="2022-10-27T13:44:03Z" level=error
time="2022-10-27T13:44:03Z" level=error msg="Error: creating EC2 Instance: InvalidNetworkInterface.InUse: Interface: [eni-0b02b09699ec55970] in use."
time="2022-10-27T13:44:03Z" level=error msg="\tstatus code: 400, request id: 202516bd-d898-47f3-8a24-f3ebcd4f915c"
time="2022-10-27T13:44:03Z" level=error
time="2022-10-27T13:44:03Z" level=error msg="  with module.masters.aws_instance.master[0],"
time="2022-10-27T13:44:03Z" level=error msg="  on master/main.tf line 129, in resource \"aws_instance\" \"master\":"
time="2022-10-27T13:44:03Z" level=error msg=" 129: resource \"aws_instance\" \"master\" {"

Terraform Configuration Files

https://github.com/openshift/installer/blob/master/data/data/aws/cluster/master/main.tf

Steps to Reproduce

terraform apply

Debug Output

https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/origin-ci-test/pr-logs/pull/openshift_cluster-network-operator/1589/pull-ci-openshift-cluster-network-operator-master-e2e-ovn-hybrid-step-registry/1585619881594720256/artifacts/e2e-ovn-hybrid-step-registry/ipi-install-install/artifacts/.openshift_install.log

Panic Output

No response

Important Factoids

Using the attachment property in the aws_network_interface doesn't seem to work with device_index = 0:

resource "aws_network_interface" "master" {
  count       = var.instance_count
  description = local.description
  subnet_id   = var.az_to_subnet_id[var.availability_zones[count.index]]

  security_groups = var.master_sg_ids

  attachment {
    instance     = aws_instance.master[count.index].id
    device_index = 0
  }

  tags = merge(
    {
      "Name" = "${var.cluster_id}-master-${count.index}"
    },
    var.tags,
  )
}
ERROR Error: error attaching EC2 Network Interface (eni-020bbcb9453e509b8/i-051e77369626266a3): InvalidParameterValue: Instance 'i-051e77369626266a3' already has an interface attached at device index '0'. 
ERROR 	status code: 400, request id: 2be4a3d1-a4e4-4e21-870e-8863e8b0be0b 
ERROR                                              
ERROR   with module.masters.aws_network_interface.master[0], 
ERROR   on master/main.tf line 114, in resource "aws_network_interface" "master": 
ERROR  114: resource "aws_network_interface" "master" { 

References

No response

Would you like to implement a fix?

No response

@r4f4 r4f4 added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Oct 27, 2022
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/vpc Issues and PRs that pertain to the vpc service. label Oct 27, 2022
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/vpc Issues and PRs that pertain to the vpc service.
Projects
None yet
Development

No branches or pull requests

2 participants