Skip to content

Commit

Permalink
add set groups (#529)
Browse files Browse the repository at this point in the history
  • Loading branch information
hila-krut-sysdig authored Jun 26, 2024
1 parent 9cdac5a commit b73ca2e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
15 changes: 8 additions & 7 deletions sysdig/data_source_sysdig_secure_posture_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,8 @@ func dataSourceSysdigSecurePosturePolicyRead(ctx context.Context, d *schema.Reso
if err != nil {
return diag.FromErr(err)
}
err = d.Set(SchemaIDKey, policy.ID)
if err != nil {
return diag.FromErr(err)
}

d.SetId(policy.ID)

err = d.Set(SchemaNameKey, policy.Name)
if err != nil {
Expand Down Expand Up @@ -120,11 +118,14 @@ func dataSourceSysdigSecurePosturePolicyRead(ctx context.Context, d *schema.Reso
return diag.FromErr(err)
}

// Set groups
if _, err := setGroups(d, policy.RequirementsGroup); err != nil {
groupsData, err := setGroups(d, policy.RequirementsGroup)
if err != nil {
return diag.FromErr(err)
}
err = d.Set(SchemaGroupKey, groupsData)
if err != nil {
return diag.FromErr(err)
}

d.SetId(policy.ID)
return nil
}
9 changes: 8 additions & 1 deletion sysdig/resource_sysdig_secure_posture_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,16 @@ func resourceSysdigSecurePosturePolicyRead(ctx context.Context, d *schema.Resour
}

// Set groups
if _, err := setGroups(d, policy.RequirementsGroup); err != nil {
groupsData, err := setGroups(d, policy.RequirementsGroup)
if err != nil {
return diag.FromErr(err)
}

err = d.Set(SchemaGroupKey, groupsData)
if err != nil {
return diag.FromErr(err)
}

return nil
}

Expand Down

0 comments on commit b73ca2e

Please sign in to comment.