terraform-provider-aws icon indicating copy to clipboard operation
terraform-provider-aws copied to clipboard

error reading EC2 Network ACL Rule

Open cdancy opened this issue 3 years ago • 8 comments

Now that THIS ISSUE has finally been resolved we are now seeing this which looks similar and I'm wondering if the same logic can be applied?

[2022-02-11T19:54:26.983Z]         	            	               

[2022-02-11T19:54:26.983Z]         	            	               Error: error reading EC2 Network ACL Rule (nacl-3954984924): couldn't find resource

[2022-02-11T19:54:26.983Z]         	            	               

[2022-02-11T19:54:26.983Z]         	            	                 with module.vpc.aws_network_acl_rule.public_outbound[2],

[2022-02-11T19:54:26.983Z]         	            	                 on .terraform/modules/vpc/main.tf line 668, in resource "aws_network_acl_rule" "public_outbound":

[2022-02-11T19:54:26.983Z]         	            	                668: resource "aws_network_acl_rule" "public_outbound" {

cdancy avatar Feb 11 '22 20:02 cdancy

@cdancy Thanks for raising this issue. Which version of the Terraform AWS Provider are you using? In v4.0.0 we have started to use the paginated DescribeNetworkAcls call:

https://github.com/hashicorp/terraform-provider-aws/blob/7a0664683357fe4a515dc90fa48ec7751ab69cd9/internal/service/ec2/network_acl.go#L182

https://github.com/hashicorp/terraform-provider-aws/blob/7a0664683357fe4a515dc90fa48ec7751ab69cd9/internal/service/ec2/find.go#L773-L778

https://github.com/hashicorp/terraform-provider-aws/blob/7a0664683357fe4a515dc90fa48ec7751ab69cd9/internal/service/ec2/find.go#L722-L723

https://github.com/hashicorp/terraform-provider-aws/blob/7a0664683357fe4a515dc90fa48ec7751ab69cd9/internal/service/ec2/find.go#L740-L743

ewbankkit avatar Feb 11 '22 20:02 ewbankkit

@ewbankkit just started trying out 4.0.0 this morning and saw this which is not an issue we've encountered before. Not sure if it's related or not...

cdancy avatar Feb 11 '22 20:02 cdancy

I'm seeing a similar pattern using AWS provider 4.5.0.

Error: error reading EC2 Network ACL Rule (nacl-12345): empty result

Error: error reading EC2 Network ACL Association (aclassoc-12345): empty result

It appears to be intermittent though.

rpf3 avatar Apr 14 '22 19:04 rpf3

+1 This seems like intermittent issue. error reading EC2 Network ACL Rule (nacl-12345): couldn't find resource with module.nacl["infra"].aws_network_acl_rule.ingress["110"]

Behaviour:

Already NACL had nearly 10 rules and while adding new rules (2 ingress and 2 egress) faced the issue for 1st ingress. However in the UI of AWS, I see all new 4 rules were added. I have tried to re-run to make the state consistent and below is the output module.nacl["infra"].aws_network_acl_rule.ingress["110"] is tainted, so must be replaced +/- resource "aws_network_acl_rule" "ingress" { ~ id = "nacl-1234" -> (known after apply) ~ protocol = "6" -> "tcp" # (7 unchanged attributes hidden) }

Plan: 1 to add, 0 to change, 1 to destroy.

Output : Ingress rule 110 was deleted and don't see any addition of the rule 110

So I have rerun the apply to add this rule and this time it has added the rule

ksanjay7 avatar Jun 06 '22 21:06 ksanjay7

+1 on getting the "empty result" for nacl association

nrastogiakoya avatar Oct 15 '22 22:10 nrastogiakoya

Still seeing this regularly on AWS provider v4.39

DacoDev avatar Nov 17 '22 16:11 DacoDev

Yes, and it's a super frustrating error for running smooth pipelines

nrastogiakoya avatar Nov 17 '22 18:11 nrastogiakoya

I'm also seeing this using provider ver 4.15.1

mgarber-ops avatar Nov 30 '22 16:11 mgarber-ops

It is quite an annoying error. Reran the plan, the plan out indicated the associations would be replaced. The associations were created successfully after, maybe multiple times, replan/reapply.

$ terraform version
Terraform v1.3.7
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v4.48.0

tigerpeng2001 avatar Jan 19 '23 21:01 tigerpeng2001

@tigerpeng2001 yeah we have a wrapper script that basically retries upon some failure message encountered. Usually after a handful of retries, with some waits thrown in between for good measure, things go through. Kind of ridiculous solution but it does work 90% of the time

cdancy avatar Jan 19 '23 21:01 cdancy

This functionality has been released in v4.59.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[bot] avatar Mar 16 '23 21:03 github-actions[bot]

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[bot] avatar Apr 16 '23 02:04 github-actions[bot]