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.75k stars 9.11k forks source link

[Bug]: Regression in version 5.60, aws_security_group_rule does not detect removed/changed Security Group Rule #39463

Open tonimaki opened 2 hours ago

tonimaki commented 2 hours ago

Terraform Core Version

1.9.5

AWS Provider Version

5.60, 5.68

Affected Resource(s)

Expected Behavior

When a Security Group Rule is removed/changed in AWS Console, the terraform plan should detect that and suggest recreation/modification of the removed/changed rule.

Actual Behavior

Since version 5.60, when a Security Group Rule is removed/changed in AWS Console, the terraform plan does not suggest any changes

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

provider "aws" {
  region = "us-east-1"
}

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      #version = "5.59.0" # Still detects removed SG rule
      #version = "5.60.0" # Does not detect removed SG rule
      version = "5.68.0" # Does not detect removed SG rule
    }
  }
}

resource "aws_security_group" "test_sg" {
  name = "test_sg"
}

resource "aws_security_group_rule" "test_rule" {
  type              = "ingress"
  from_port         = 443
  to_port           = 443
  protocol          = "tcp"
  self              = true
  security_group_id = aws_security_group.test_sg.id
}

Steps to Reproduce

  1. Create the security group and security group rule by terraform apply
  2. Log into AWS Console and change the created rule from the created security group
  3. Run terraform plan -> "No changes. Your infrastructure matches the configuration."
  4. Remove the created rule from the created security group
  5. Run terraform plan -> "No changes. Your infrastructure matches the configuration."

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 2 hours ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue