Skip to content
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

f/aws_config_remediation_configuration: Support for automatic remedia… #15568

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions aws/resource_aws_config_remediation_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,24 @@ func resourceAwsConfigRemediationConfiguration() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"automatic": {
Type: schema.TypeBool,
Optional: true,
},
"maximum_automatic_attempts": {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
Default: 5,
ValidateFunc: validation.IntBetween(1, 25),
},
"retry_attempt_seconds": {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
Default: 60,
ValidateFunc: validation.IntBetween(1, 2678000),
},
"config_rule_name": {
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -141,6 +159,15 @@ func resourceAwsConfigRemediationConfigurationPut(d *schema.ResourceData, meta i
}
remediationConfigurationInput.Parameters = params
}
if v, ok := d.GetOk("automatic"); ok {
remediationConfigurationInput.Automatic = aws.Bool(v.(bool))
}
if v, ok := d.GetOk("maximum_automatic_attempts"); ok {
remediationConfigurationInput.MaximumAutomaticAttempts = aws.Int64(int64(v.(int)))
}
if v, ok := d.GetOk("retry_attempt_seconds"); ok {
remediationConfigurationInput.RetryAttemptSeconds = aws.Int64(int64(v.(int)))
}
if v, ok := d.GetOk("resource_type"); ok {
remediationConfigurationInput.ResourceType = aws.String(v.(string))
}
Expand Down Expand Up @@ -195,6 +222,9 @@ func resourceAwsConfigRemediationConfigurationRead(d *schema.ResourceData, meta

remediationConfiguration := out.RemediationConfigurations[0]
d.Set("arn", remediationConfiguration.Arn)
d.Set("automatic", remediationConfiguration.Automatic)
d.Set("maximum_automatic_attempts", remediationConfiguration.MaximumAutomaticAttempts)
d.Set("retry_attempt_seconds", remediationConfiguration.RetryAttemptSeconds)
d.Set("config_rule_name", remediationConfiguration.ConfigRuleName)
d.Set("resource_type", remediationConfiguration.ResourceType)
d.Set("target_id", remediationConfiguration.TargetId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ resource "aws_config_remediation_configuration" "this" {

The following arguments are supported:

* `automatic` - (Optional) The remediation is triggered automatically.
* `maximum_automatic_attempts` - (Optional) The maximum number of failed attempts for auto-remediation. The default is 5.
* `retry_attempt_seconds` - (Optional) Maximum time in seconds that AWS Config runs auto-remediation. The default is 60 seconds.
* `config_rule_name` - (Required) The name of the AWS Config rule
* `resource_type` - (Optional) The type of a resource
* `target_id` - (Required) Target ID is the name of the public document
Expand Down