-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Open
Labels
bugAddresses a defect in current functionality.Addresses a defect in current functionality.service/guarddutyIssues and PRs that pertain to the guardduty service.Issues and PRs that pertain to the guardduty service.
Description
Terraform and AWS Provider Version
Terraform v1.13.4
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v6.18.0Affected Resource(s) or Data Source(s)
aws_guardduty_organization_configuration_feature
Expected Behavior
"No changes. Your infrastructure matches the configuration."
Actual Behavior
A diff is produced on every plan, wanting to replace the resource:
# aws_guardduty_organization_configuration_feature.guardduty must be replaced
-/+ resource "aws_guardduty_organization_configuration_feature" "guardduty" {
~ id = "<<redacted>>/RUNTIME_MONITORING" -> (known after apply)
name = "RUNTIME_MONITORING"
# (3 unchanged attributes hidden)
~ additional_configuration {
~ name = "ECS_FARGATE_AGENT_MANAGEMENT" -> "EC2_AGENT_MANAGEMENT" # forces replacement
# (1 unchanged attribute hidden)
}
~ additional_configuration {
~ name = "EC2_AGENT_MANAGEMENT" -> "ECS_FARGATE_AGENT_MANAGEMENT" # forces replacement
# (1 unchanged attribute hidden)
}
# (1 unchanged block hidden)
}
Relevant Error/Panic Output
No response
Sample Terraform Configuration
Click to expand configuration
resource "aws_guardduty_detector" "guardduty" {}
resource "aws_guardduty_organization_configuration" "guardduty" {
# Gets a bit messy with Terraform
auto_enable_organization_members = "NONE"
detector_id = aws_guardduty_detector.guardduty.id
}
resource "aws_guardduty_organization_configuration_feature" "runtime_monitoring" {
detector_id = aws_guardduty_detector.guardduty.id
name = "RUNTIME_MONITORING"
auto_enable = "NONE"
dynamic "additional_configuration" {
for_each = toset(["EC2_AGENT_MANAGEMENT", "ECS_FARGATE_AGENT_MANAGEMENT", "EKS_ADDON_MANAGEMENT"])
iterator = ac
content {
name = ac.key
auto_enable = "NONE"
}
}
depends_on = [aws_guardduty_organization_configuration.guardduty]
}Steps to Reproduce
- Have an AWS organization
- Apply the plan
- Plan again to see a diff recreating the
aws_guardduty_organization_configuration_featureresource
Debug Logging
Click to expand log output
GenAI / LLM Assisted Development
n/a
Important Facts and References
Having the additional_configuration blocks in the "correct" order removes the diff:
resource "aws_guardduty_organization_configuration_feature" "runtime_monitoring" {
detector_id = aws_guardduty_detector.guardduty.id
name = "RUNTIME_MONITORING"
auto_enable = "NONE"
additional_configuration {
name = "ECS_FARGATE_AGENT_MANAGEMENT"
auto_enable = "NONE"
}
additional_configuration {
name = "EC2_AGENT_MANAGEMENT"
auto_enable = "NONE"
}
additional_configuration {
name = "EKS_ADDON_MANAGEMENT"
auto_enable = "NONE"
}
depends_on = [aws_guardduty_organization_configuration.guardduty]
}Similar issue was fixed for aws_guardduty_detector_feature in #44627
Would you like to implement a fix?
No
Metadata
Metadata
Assignees
Labels
bugAddresses a defect in current functionality.Addresses a defect in current functionality.service/guarddutyIssues and PRs that pertain to the guardduty service.Issues and PRs that pertain to the guardduty service.