-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot re-enable aws_securityhub_standards_control rules without taint #20434
Comments
I am also experiencing this while updating resource "aws_securityhub_standards_control" "apig_5" {
control_status = var.ec_apig_5 == true ? "ENABLED" : "DISABLED"
disabled_reason = var.ec_apig_5 == true ? null : "Disabled to comply with company policy."
standards_control_arn = "arn:aws:securityhub:${data.aws_region.main.name}:${data.aws_caller_identity.main.account_id}:control/aws-foundational-security-best-practices/v/1.0.0/APIGateway.5"
} Initial creation of the resource is successful regardless of a
|
I have confirmed that this can be avoided by making such a statement, but this is a hacky cop-out. resource "null_resource" "apig_5" {
triggers = {
status = var.ec_apig_5 == true ? "ENABLED" : "DISABLED"
}
}
resource "aws_securityhub_standards_control" "apig_5" {
control_status = var.ec_apig_5 == true ? "ENABLED" : "DISABLED"
disabled_reason = var.ec_apig_5 == true ? null : "Disabled to comply with company policy."
standards_control_arn = "arn:aws:securityhub:${data.aws_region.main.name}:${data.aws_caller_identity.main.account_id}:control/aws-foundational-security-best-practices/v/1.0.0/APIGateway.5"
lifecycle {
replace_triggered_by = [null_resource.apig_5]
}
} |
There was an update to allow cloud formation to specify which controls to disable. |
Community Note
Terraform CLI and Terraform AWS Provider Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
N/A
Panic Output
N/A
Expected Behavior
I expect Terraform to re-enable the Security Hub control.
Actual Behavior
I cannot simply re-enable the control, because Terraform is updating the resource in place, and not
null
-ing out the disabled_reason.I get a response:
You can see that in the plan that looks something like this:
Steps to Reproduce
terraform apply
the original snippet to disable a Security Hub controlExample of trying to enable the control again:
(I tried also
disabled_reason = null
anddisabled_reason = ""
to no avail. The proposed plan is always only tweaking thecontrol_status
and not thedisabled_reason
.)terraform apply
and 😢 as noted above.Important Factoids
terraform taint aws_securityhub_standards_control.something
seems to do the trick.References
The text was updated successfully, but these errors were encountered: