Skip to content

Commit

Permalink
Tried to fix semgrep job errors
Browse files Browse the repository at this point in the history
  • Loading branch information
daftkid committed May 19, 2023
1 parent a55a5df commit abfa444
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions internal/service/fms/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"github.com/hashicorp/terraform-provider-aws/internal/conns"
"github.com/hashicorp/terraform-provider-aws/internal/create"
"github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag"
"github.com/hashicorp/terraform-provider-aws/internal/flex"
tftags "github.com/hashicorp/terraform-provider-aws/internal/tags"
Expand All @@ -21,6 +22,10 @@ import (
"github.com/hashicorp/terraform-provider-aws/names"
)

const (
ResNamePolicy = "Policy"
)

// @SDKResource("aws_fms_policy", name="Policy")
// @Tags(identifierAttribute="arn")
func ResourcePolicy() *schema.Resource {
Expand Down Expand Up @@ -338,20 +343,20 @@ func resourcePolicyFlattenPolicy(d *schema.ResourceData, resp *fms.GetPolicyOutp
d.Set("name", resp.Policy.PolicyName)
d.Set("exclude_resource_tags", resp.Policy.ExcludeResourceTags)
if err := d.Set("exclude_map", flattenPolicyMap(resp.Policy.ExcludeMap)); err != nil {
return err
return create.SettingError(names.FMS, ResNamePolicy, d.Id(), "exclude_resource_tags", err)
}
if err := d.Set("include_map", flattenPolicyMap(resp.Policy.IncludeMap)); err != nil {
return err
return create.SettingError(names.FMS, ResNamePolicy, d.Id(), "include_map", err)
}
d.Set("remediation_enabled", resp.Policy.RemediationEnabled)
if err := d.Set("resource_type_list", resp.Policy.ResourceTypeList); err != nil {
return err
return create.SettingError(names.FMS, ResNamePolicy, d.Id(), "remediation_enabled", err)
}
d.Set("delete_unused_fm_managed_resources", resp.Policy.DeleteUnusedFMManagedResources)
d.Set("resource_type", resp.Policy.ResourceType)
d.Set("policy_update_token", resp.Policy.PolicyUpdateToken)
if err := d.Set("resource_tags", flattenResourceTags(resp.Policy.ResourceTags)); err != nil {
return err
return create.SettingError(names.FMS, ResNamePolicy, d.Id(), "policy_update_token", err)
}

securityServicePolicy := []map[string]interface{}{{
Expand All @@ -361,7 +366,7 @@ func resourcePolicyFlattenPolicy(d *schema.ResourceData, resp *fms.GetPolicyOutp
}}

if err := d.Set("security_service_policy_data", securityServicePolicy); err != nil {
return err
return create.SettingError(names.FMS, ResNamePolicy, d.Id(), "security_service_policy_data", err)
}

return nil
Expand Down

0 comments on commit abfa444

Please sign in to comment.