-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Open
Labels
service/guarddutyIssues and PRs that pertain to the guardduty service.Issues and PRs that pertain to the guardduty service.upstreamAddresses functionality related to the cloud provider.Addresses functionality related to the cloud provider.
Description
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform Version
0.12.26
Affected Resource(s)
- aws_guardduty_member
Terraform Configuration Files
# In an organization infrastructure account, which we designated as the GuardDuty admin account:
resource "aws_guardduty_detector" "main" {
enable = true
}
resource "aws_guardduty_organization_configuration" "main" {
auto_enable = true
detector_id = aws_guardduty_detector.main.id
}
resource "aws_guardduty_member" "trussworks_sandbox" {
account_id = local.trussworks_sandbox_id
detector_id = aws_guardduty_detector.main.id
email = local.trussworks_sandbox_email
invite = false
disable_email_notification = true
}
In this case, trussworks_sandbox
is an account we created before we enabled GuardDuty, so it was not automatically added a member automatically via the auto_enable
in aws_guardduty_organization_configuration
.
No GuardDuty resources are configured in the trussworks_sandbox
account because GuardDuty appears to create the detector automatically when it is added as a member.
Expected Behavior
Running Terraform with this code should create the member, and then subsequent runs should say no changes are necessary because the membership is already created.
Actual Behavior
Running Terraform once with this code successfully created the membership, as expected. However, on subsequent terraform apply
executions, it attempts to recreate the resource:
# aws_guardduty_member.trussworks_sandbox must be replaced
-/+ resource "aws_guardduty_member" "trussworks_sandbox" {
account_id = "REDACTED"
detector_id = "REDACTED"
disable_email_notification = true
+ email = "[email protected]" # forces replacement
~ id = "REDACTED" -> (known after apply)
~ invite = true -> false
~ relationship_status = "Enabled" -> (known after apply)
}
Steps to Reproduce
- Create an AWS organization with three accounts -- a "master" account, the GuardDuty admin account, and another account.
- Make the GuardDuty admin account the GuardDuty admin account (...obviously), and configure as above.
- Add the third account as a GuardDuty member with the code above.
- Run
terraform apply
, and then runterraform apply
again.
chrisgilmerproj, JBartlett86, esacteksab, albuch, man8 and 54 more
Metadata
Metadata
Assignees
Labels
service/guarddutyIssues and PRs that pertain to the guardduty service.Issues and PRs that pertain to the guardduty service.upstreamAddresses functionality related to the cloud provider.Addresses functionality related to the cloud provider.