-
Notifications
You must be signed in to change notification settings - Fork 54
Add terraform support to Okta ML Policy #675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add terraform support to Okta ML Policy #675
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some minor comments. I'll let someone else look at the implication of the changes as I don't have any experience with this repo.
.vscode/launch.json
Outdated
| @@ -0,0 +1,15 @@ | |||
| { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to push this. If you can, please add it to gitignore so this isn't tracked in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might need to delete it from your local machine and push once to remove it from here
sysdig/tfresource.go
Outdated
| // TODO: Iterate over a list of rules instead of hard-coding the index values | ||
| // TODO: Should we assume that only a single Malware rule can be attached to a policy? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These TODOs are intentionally kept to match the AWS ML implementation pattern. Both AWS ML and Okta ML policies currently support a single rule per policy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now yes the behavior is 1 rule per policy for these non-Falco types like malware, drift and ML ones. So we can remove the comment if needed
sysdig/tfresource.go
Outdated
| }) | ||
| } | ||
|
|
||
| _ = d.Set("rule", rules) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an error being ignored? We should handle it if so.
| } | ||
|
|
||
| func oktaMLPolicyFromResourceData(d *schema.ResourceData) (v2.PolicyRulesComposite, error) { | ||
| policy := &v2.PolicyRulesComposite{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see there's similar code for other types, but I think it makes more sense to avoid the pointer in this function and pass &policy to oktaMLPolicyReducer, which is where a pointer is actually needed.
| return diag.FromErr(err) | ||
| } | ||
|
|
||
| id, _ := strconv.Atoi(d.Id()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's handle the error here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some minor comments. Let me know if you want me to add it to your other branch that you plan to merge
.vscode/launch.json
Outdated
| @@ -0,0 +1,15 @@ | |||
| { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might need to delete it from your local machine and push once to remove it from here
sysdig/tfresource.go
Outdated
| // TODO: Iterate over a list of rules instead of hard-coding the index values | ||
| // TODO: Should we assume that only a single Malware rule can be attached to a policy? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now yes the behavior is 1 rule per policy for these non-Falco types like malware, drift and ML ones. So we can remove the comment if needed
|
|
||
| * `anomalous_console_login` - Anomaly detection settings for logins. | ||
| * `enabled` - Whether anomaly detection is enabled. | ||
| * `threshold` - Confidence level threshold for triggering alerts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add that only supported values for the threshold are 1, 2 and 3 please? If you would like you can update for the other ML types as well (I think they were missed there too)
|
|
||
| * `description` - (Required) Rule description. | ||
| * `anomalous_console_login` - (Required) This attribute allows you to activate anomaly detection for logins and adjust its settings. | ||
| * `threshold` - (Required) Trigger at or above confidence level. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there should be an enabled field here too similar to how you have on your data source.
Changed threshold value descriptions from 'High/Medium/Low' to 'Default/High/Higher' for ML policies
Key changes:
sysdig_secure_okta_ml_policy