Skip to content

Commit 22532bb

Browse files
committed
fix: ignore-order-of-controls
1 parent 48c8be9 commit 22532bb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

sysdig/resource_sysdig_secure_posture_policy.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func createGroupSchema(i int) *schema.Resource {
2727
Required: true,
2828
},
2929
"requirement": {
30-
Type: schema.TypeList,
30+
Type: schema.TypeSet,
3131
Optional: true,
3232
Elem: &schema.Resource{
3333
Schema: map[string]*schema.Schema{
@@ -44,7 +44,7 @@ func createGroupSchema(i int) *schema.Resource {
4444
Required: true,
4545
},
4646
"control": {
47-
Type: schema.TypeList,
47+
Type: schema.TypeSet,
4848
Optional: true,
4949
Elem: &schema.Resource{
5050
Schema: map[string]*schema.Schema{
@@ -86,7 +86,7 @@ func createGroupSchema(i int) *schema.Resource {
8686
Elem: createGroupSchema(i + 1),
8787
},
8888
"requirement": {
89-
Type: schema.TypeList,
89+
Type: schema.TypeSet,
9090
Optional: true,
9191
Elem: &schema.Resource{
9292
Schema: map[string]*schema.Schema{
@@ -103,7 +103,7 @@ func createGroupSchema(i int) *schema.Resource {
103103
Required: true,
104104
},
105105
"control": {
106-
Type: schema.TypeList,
106+
Type: schema.TypeSet,
107107
Optional: true,
108108
Elem: &schema.Resource{
109109
Schema: map[string]*schema.Schema{
@@ -464,17 +464,17 @@ func extractGroupsRecursive(data interface{}) []v2.CreateRequirementsGroup {
464464
Description: d["description"].(string),
465465
}
466466

467-
if reqs, ok := d["requirement"].([]interface{}); ok {
468-
for _, reqData := range reqs {
467+
if reqs, ok := d["requirement"].(*schema.Set); ok {
468+
for _, reqData := range reqs.List() {
469469
reqMap := reqData.(map[string]interface{})
470470
requirement := v2.CreateRequirement{
471471
ID: reqMap["id"].(string),
472472
Name: reqMap["name"].(string),
473473
Description: reqMap["description"].(string),
474474
}
475475

476-
if controlsData, ok := reqMap["control"].([]interface{}); ok {
477-
for _, controlData := range controlsData {
476+
if controlsData, ok := reqMap["control"].(*schema.Set); ok {
477+
for _, controlData := range controlsData.List() {
478478
controlMap := controlData.(map[string]interface{})
479479
control := v2.CreateRequirementControl{
480480
Name: controlMap["name"].(string),

0 commit comments

Comments
 (0)