Skip to content

Commit

Permalink
Skip condition field of iam resources (#10962)
Browse files Browse the repository at this point in the history
  • Loading branch information
trodge committed Jun 18, 2024
1 parent ade0a1e commit 9a15e62
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/diff-processor/detector/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func getChangedFieldsFromSchemaDiff(schemaDiff diff.SchemaDiff) map[string]Resou
// Skip the project field.
continue
}
if strings.Contains(resource, "iam") && field == "condition" {
// Skip the condition field of iam resources because some iam resources do not support it.
continue
}
if fieldDiff.New == nil {
// Skip deleted fields.
continue
Expand All @@ -69,7 +73,9 @@ func getChangedFieldsFromSchemaDiff(schemaDiff diff.SchemaDiff) map[string]Resou
resourceChanges[field] = &Field{Changed: true}
}
}
changedFields[resource] = resourceChanges
if len(resourceChanges) > 0 {
changedFields[resource] = resourceChanges
}
}
return changedFields
}
Expand Down
7 changes: 7 additions & 0 deletions tools/diff-processor/detector/detector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ func TestGetChangedFieldsFromSchemaDiff(t *testing.T) {
},
},
},
"iam_resource": diff.ResourceDiff{
Fields: map[string]diff.FieldDiff{
"condition": {
New: &schema.Schema{},
},
},
},
},
changedFields: map[string]ResourceChanges{
"covered_resource": {
Expand Down

0 comments on commit 9a15e62

Please sign in to comment.