Skip to content
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

[datadog_security_monitoring_rule] Updating schema validation for field type #1640

Merged
merged 3 commits into from
Nov 21, 2022

Conversation

symphony-elias
Copy link
Contributor

We'd like to explicitly remove support for infrastructure_configuration and cloud_configuration rules as their management with TF is broken. See RFC for more details.

@symphony-elias symphony-elias added the do-not-merge/WIP Do not merge this PR label Nov 14, 2022
@symphony-elias symphony-elias requested review from a team as code owners November 14, 2022 18:02
@symphony-elias symphony-elias requested a review from a team as a code owner November 14, 2022 18:46
@symphony-elias symphony-elias changed the title Updating schema of datadog_security_monitoring_rule resource [datadog_security_monitoring_rule] Updating schema validation for field type Nov 15, 2022
@symphony-elias symphony-elias removed the do-not-merge/WIP Do not merge this PR label Nov 15, 2022
Copy link
Contributor

@maycmlee maycmlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for docs.

@symphony-elias symphony-elias self-assigned this Nov 16, 2022
Description: "The rule type.",
Default: "log_detection",
Type: schema.TypeString,
ValidateDiagFunc: validators.ValidateStringEnumValue(datadogV2.SECURITYMONITORINGRULETYPEREAD_LOG_DETECTION,
Copy link
Contributor Author

@symphony-elias symphony-elias Nov 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't reuse OOTB validator provided by the TF SDK because:

  • documentation is generated by checking the output of the ValidateDiagFunc when passing an EnumChecker
  • PR build fails when manually updating the documentation

Copy link
Contributor Author

@symphony-elias symphony-elias Nov 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2022-11-21 at 10 41 55

Screenshot 2022-11-21 at 10 42 07

In details: `validation.StringInSlice` takes an array of strings. However, the `datadogV2` constants have a specific type `type SecurityMonitoringRuleTypeRead string` which means we'll have to create same constants of type string or change the type of these constants. When using the validator, it doesn't update the doc

@therve therve merged commit 0d8d935 into master Nov 21, 2022
@therve therve deleted the elias.croze/sec-5988 branch November 21, 2022 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants