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]: Terraform state is not reflected correctly using cross-account ARN in aws_ec2_network_insights_path. #31123

Closed
alex-zige opened this issue May 3, 2023 · 4 comments · Fixed by #33168
Labels
bug Addresses a defect in current functionality. service/vpc Issues and PRs that pertain to the vpc service.
Milestone

Comments

@alex-zige
Copy link

alex-zige commented May 3, 2023

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

Run terramform apply with the cross account ENI as source and destination (resource ARN)
The terraform state is populated correctly with correct values and mappings.
Re-run terraform apply will not replace the existing paths.

Actual Behavior

When uses cross account aws_ec2_network_insights_path features, the source/destination can reference the ARN instead.

ie. "arn:aws:ec2:ap-southeast-2:account-id:network-interface/eni-id".

However, once the resource is created, the terraform state does not reference the ARN and fallback to the source account source and destination. This causes the Terraform state to become unsynchronized, at the next subsequent terraform apply, will cause re-creating those path with new resources using the provided cross-account ARN.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_ec2_network_insights_path" "this" {
  source           = "arn:aws:ec2:ap-southeast-2:src-account-id:network-interface/eni-id"
  destination      = "arn:aws:ec2:ap-southeast-2:dest-account-id:network-interface/eni-id"
  destination_port = "80"
  protocol         = "tcp"
}

Steps to Reproduce

  1. Enable Cross Account reachbility analyzer within the org .https://docs.aws.amazon.com/vpc/latest/reachability/multi-account.html
  2. Create aws_ec2_network_insights_path with the cross account configuration provided and run terraform apply
  3. After the path created, do not change the TF configuration file, and run Terrafrom plan
  4. Review the changes to be updated.
  5. Run Terraform apply will create new paths instead.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@alex-zige alex-zige added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels May 3, 2023
@github-actions
Copy link

github-actions bot commented May 3, 2023

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 May 3, 2023
@alex-zige alex-zige changed the title [Bug]: Terraform state is not reflect correctly using cross-account ARN in aws_ec2_network_insights_path. [Bug]: Terraform state is not reflected correctly using cross-account ARN in aws_ec2_network_insights_path. May 3, 2023
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label May 3, 2023
@yoyoman21
Copy link

Is terraform having support for cross account ec2 network insight path resource for latest aws provider version, because I have the cross account setup done but its not working via terraform. The same thing works through console. The network path is taking same account id as source and destination even if the instances are in different account.

@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
3 participants