Add support for policy_update_patterns in policy_set#2030
Open
nithishravindra wants to merge 3 commits intomainfrom
Open
Add support for policy_update_patterns in policy_set#2030nithishravindra wants to merge 3 commits intomainfrom
nithishravindra wants to merge 3 commits intomainfrom
Conversation
sana-faraz
reviewed
Apr 17, 2026
| } | ||
|
|
||
| if d.HasChange("policy_update_patterns") { | ||
| for _, pattern := range d.Get("policy_update_patterns").([]interface{}) { |
Contributor
There was a problem hiding this comment.
nit: iteration can be moved to another function and reused
sana-faraz
reviewed
Apr 17, 2026
|
|
||
| // Don't bother updating the policy set's attributes if they haven't changed | ||
| if d.HasChange("name") || d.HasChange("description") || d.HasChange("global") || d.HasChange("vcs_repo") || d.HasChange("overridable") || d.HasChange("agent_enabled") || d.HasChange("policy_tool_version") { | ||
| if d.HasChange("name") || d.HasChange("description") || d.HasChange("global") || d.HasChange("vcs_repo") || d.HasChange("overridable") || d.HasChange("agent_enabled") || d.HasChange("policy_tool_version") || d.HasChange("policy_update_patterns") { |
Contributor
There was a problem hiding this comment.
nit: Can be rewitten like
fields := []string{
"name", "description", "global", "vcs_repo",
"overridable", "agent_enabled", "policy_tool_version",
"policy_update_patterns",
}
hasAnyChange := false
for _, field := range fields {
if d.HasChange(field) {
hasAnyChange = true
break
}
}
if hasAnyChange {
....
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add PolicyUpdatePatterns support for policy sets (read/create/update) and tests
Remember to:
Testing plan
External links
Include any links here that might be helpful for people reviewing your PR. If there are none, feel free to delete this section.
Output from acceptance tests
Please run applicable acceptance tests locally and include the output here. See testing.md to learn how to run acceptance tests.
If you are an external contributor, your contribution(s) will first be reviewed before running them against the project's CI pipeline.
Rollback Plan
Changes to Security Controls