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.87k stars 9.21k forks source link

[Bug]: Provider ignoring error from AWS and treating as success for aws_security_group_rule #33854

Open brucedewald opened 1 year ago

brucedewald commented 1 year ago

Terraform Core Version

1.5.2

AWS Provider Version

5.20.0

Affected Resource(s)

Expected Behavior

Terraform should acknowledge error from AWS API and report to user that resource couldn't be destroyed.

Actual Behavior

Terraform reported that resource was successfully destroyed and removed it from state file.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_security_group" "test_security_group" {
  description = "testing"
  vpc_id      = var.vpc_id
  name        = "testing"
}

resource "aws_security_group_rule" "test_security_group_rule" {
  security_group_id = aws_security_group.test_security_group.id
  description       = "[TF] Test Rule"
  type              = "egress"
  from_port         = 0
  to_port           = 0
  protocol          = "-1"
  cidr_blocks       = ["0.0.0.0/0"]
}

# resource "aws_security_group_rule" "test_security_group_rule" {
#   security_group_id = aws_security_group.test_security_group.id
#   description       = "[TF] Test Rule"
#   type              = "egress"
#   from_port         = 443
#   to_port           = 443
#   protocol          = "tcp"
#   cidr_blocks       = ["0.0.0.0/0"]
# }

Steps to Reproduce

Run the above code as is. Then comment out current version of SG rule and uncomment the other one to change the protocol & ports.

Debug Output

aws_sgrevoke_debug.txt

Panic Output

No response

Important Factoids

No response

References

This is related to #33853 however I would consider this bug even higher priority since it is leading to user thinking resources are deleted and not being tracked in state file anymore.

Would you like to implement a fix?

No

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue