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.82k stars 9.17k forks source link

[Bug]: Terraform reporting that aws_guardduty_detector has been deleted #31105

Open olbees opened 1 year ago

olbees commented 1 year ago

Terraform Core Version

1.4.5

AWS Provider Version

4.65.0

Affected Resource(s)

aws_guardduty_detector

Expected Behavior

Terraform detects deployed guardduty detector

Actual Behavior

Terraform reports that guardduty detector has been deleted

Relevant Error/Panic Output Snippet

Note: Objects have changed outside of Terraform

Terraform detected the following changes made outside of Terraform since the
last "terraform apply" which may have affected this plan:

  # aws_guardduty_detector.guardduty_detector has been deleted
  - resource "aws_guardduty_detector" "guardduty_detector" {
      - id                           = "82c3dc7921ec85e9323b4f6209cc6cd9" -> null
        tags                         = {}
        # (5 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Terraform Configuration Files

resource "aws_guardduty_detector" "guardduty_detector" {
  enable = true

  datasources {
    s3_logs {
      enable = true
    }
    kubernetes {
      audit_logs {
        enable = false
      }
    }
    malware_protection {
      scan_ec2_instance_with_findings {
        ebs_volumes {
          enable = true
        }
      }
    }
  }
}

Steps to Reproduce

Guardduty detector can be created by terraform but then on subsequent terraform plan, it is reporting that the guardduty detector has been deleted outside of terraform. This is not the case. The detector can be removed from state, then imported successfully with the detector id. The issue still persists after the successful import.

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 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue