Open d-christie opened 1 year ago
Voting for Prioritization
Volunteering to Work on This Issue
I had the same issue and found that I didn't have
resource "aws_guardduty_organization_admin_account" "guardduty_admin_account" {
admin_account_id = aws_organizations_account.admin_account.id
}
set to the account I tried to run "aws_guardduty_organization_configuration" on.
Terraform Core Version
0.12.31
AWS Provider Version
5.24
Affected Resource(s)
aws_guardduty_organization_configuration
deployed in GovCloud partition.Expected Behavior
Terraform configuration has a
aws_guardduty_detector
resource and aaws_guardduty_organization_configuration
resource. A targeted apply creates the detector successfully. A targeted apply creates the configuration successfully. The plan shows the set of features described in theaws_guardduty_organization_configuration
code.malware_protection
is not mentioned in code or in the plans.Actual Behavior
A targeted apply creates
aws_guardduty_detector
resource successfully. A targeted apply of theaws_guardduty_organization_configuration
resource throws aBadRequestException
error. The error message refers to the first line of this resource. The plan showsmalware_protection
in the configuration withauto_enable = (known after apply)
indicating the default values will be used. No mention ofmalware_protection
in the Terraform configuration because this feature is not available in GovCloud partition.When GuardDuty is configured through the console and imported into the state, the apply runs with no errors. any modifications result in the same
BadRequestException
error.This behaviour is not seen in commercial partition accounts. The fact that
malware_protection
is show in the GovCloud plans, whether disabled or using default values, suggests that Terraform is sending an API request with attributes invalid for the GovCloud partition.Relevant Error/Panic Output Snippet
Terraform Configuration Files
Steps to Reproduce
destroy
in two GovCloud regions to start from the start.us-gov-west-1
.apply
on detector and configuration resources. Plans showed no changes. This validates the Terraform code as being in line with what I need deployed on AWS platform.apply
on detector and configuration resources inus-gov-east-1
without first setting it up in the console and importing. Detector created successfully, configuration throwsBadRequestException
error.Debug Output
No response
Panic Output
No response
Important Factoids
Problem is seen in GovCloud regions, not in commercial regions.
References
https://registry.terraform.io/providers/hashicorp/aws/5.24.0/docs/resources/guardduty_detector https://registry.terraform.io/providers/hashicorp/aws/5.24.0/docs/resources/guardduty_organization_configuration
Would you like to implement a fix?
None