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]: replacing a aws_ec2_network_insights_path does not delete analyses first #28330

Closed
oliver-sentianse opened this issue Dec 13, 2022 · 3 comments · Fixed by #33168
Closed
Labels
bug Addresses a defect in current functionality. service/vpc Issues and PRs that pertain to the vpc service.
Milestone

Comments

@oliver-sentianse
Copy link

Terraform Core Version

1.3

AWS Provider Version

4.46

Affected Resource(s)

  • aws_ec2_network_insights_path
  • aws_ec2_network_insights_analysis

Expected Behavior

When a network insights path needs to be replaced, any dependencies that prevent destruction should be removed.

Actual Behavior

Terraform aborts with an error saying there are some analyses that must be removed. This involves a manual step therefore towards automation there should at least be a flag that allows to automate destruction of analyses.

Relevant Error/Panic Output Snippet

Error: deleting EC2 Network Insights Path (nip-xxxx): AnalysisExistsForNetworkInsightsPath: At least one analysis [nia-yyyy] exists for path nip-xxxx. Delete all the analyses before deleting this network path.

Terraform Configuration Files

resource "aws_ec2_network_insights_path" "bastion_to_web_service" {
  protocol         = "tcp"
  source           = "i-bbbbbbbb"
  destination      = "i-aaaaaaaa"
  destination_port = 443

  tags = {
    Name = "path-name"
  }
}

resource "aws_ec2_network_insights_analysis" "bastion_to_web_service" {
  network_insights_path_id = aws_ec2_network_insights_path.bastion_to_web_service.id
  wait_for_completion      = false
}

Steps to Reproduce

  1. Create 2 EC2 instances and note their instance ID, ensure they are in the same security group
  2. create this main.tf from above code, and put the instance IDs in source and destination
  3. terraform apply
  4. wait till an analysis has been completed
  5. Create a new EC2 instance and note its ID
  6. Edit the main.tf so destination is the new ID
  7. terraform apply: this will attempt to replace the insights path and abort because an analysis needs to be deleted first

Note: the edits were done by editing a larger terraform config that replaced the destination server by a new one. Here for simplicity the ec2 instance creation is done manually.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@oliver-sentianse oliver-sentianse added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Dec 13, 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 Dec 13, 2022
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Dec 13, 2022
@github-actions github-actions bot added this to the v5.14.0 milestone Aug 24, 2023
@github-actions
Copy link

This functionality has been released in v5.14.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/vpc Issues and PRs that pertain to the vpc service.
Projects
None yet
2 participants