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.74k stars 9.09k forks source link

[Enhancement]: Support custom parameters for security hub controls #35447

Open RanganMahesh opened 7 months ago

RanganMahesh commented 7 months ago

Description

AWS has recently released a features that allows users to modify certain parameters that is used to evaluate the control: Custom control parameters

List of controls which allow customer parameters: Allowed list

The requirement is to update the TF Resource: aws_securityhub_standards_control to support custom control parameters where it is allowed.

Affected Resource(s) and/or Data Source(s)

aws_securityhub_standards_control https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/securityhub_standards_control

Potential Terraform Configuration

resource "aws_securityhub_standards_control" "enable_acm_and_set_parameter" {
  standards_control_arn = "arn:aws:securityhub:us-east-1:111111111111:control/aws-foundational-security-best-practices/v/1.0.0/ACM.1"
  control_status        = "ENABLED"
  parameters  = [{
    name         = "daysToExpiration"
    value_type   = "CUSTOM"
    type         = "INTEGER"
    value        = 15
  }]

  depends_on = [aws_securityhub_standards_subscription.aws-foundational-security-best-practices]
}

References

https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-controls-reference.html https://docs.aws.amazon.com/securityhub/latest/userguide/custom-control-parameters.html https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/securityhub_standards_control

Would you like to implement a fix?

None

github-actions[bot] commented 7 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

acwwat commented 4 months ago

Adding more info to this ticket.

The Security Hub distinguishes between standards control and security control. The former denotes the association of a control in the context of a standard, while the latter is the "global" control that can be included in multiple standards.

Since custom parameters are applied globally at the security control level (using the UpdateSecurityControl API), what we need is a new aws_securityhub_security_control resource.

Also note that you can already configure custom control parameters using SHCPs in both local and central configuration - see aws_securityhub_configuration_policy and aws_securityhub_configuration_policy.