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_default_rule] Warn when the rule has a deprecation date #1728

Merged
merged 5 commits into from
Jan 20, 2023

Conversation

pietrodll
Copy link
Contributor

What does this PR do?

Show a warning when a default rule has a deprecation date defined. After the deprecation date, the API blocks rule updates, which can break Terraform pipelines for users. With this change, users are notified in advance so they can remove references to deprecated rules in they Terraform configuration.

Update process

  • Changed the code to return a warning message when the deprecationDate field of a default rule is set. Note that this property only exists for default rules, so the code for datadog_security_monitoring_rule was not updated.
  • Duplicated the test for the default rule resource and recorded a cassette.
  • Manually changed the cassette response to include a deprecation date, and changed the test to be skipped if the testing session is not a replay. Unfortunately, the Terraform testing framework does not provide a way to assert on warnings. See issue Ability to test whether warnings are raised during test steps hashicorp/terraform-plugin-testing#69.
  • Debugged locally to check that the warning is generated as expected.

Note: this PR updates the API client to a non-pinned version.

clementgbcn
clementgbcn previously approved these changes Jan 18, 2023
Copy link
Contributor

@clementgbcn clementgbcn left a comment

Choose a reason for hiding this comment

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

Ok 👌 for me, you will just have to update the docs by running the command make docs.

@pietrodll pietrodll force-pushed the pietrodll/security-monitoring-deprecation-warning branch from 68172f5 to c198e2a Compare January 18, 2023 09:01
@pietrodll pietrodll force-pushed the pietrodll/security-monitoring-deprecation-warning branch from c198e2a to e94eda2 Compare January 20, 2023 15:56
@pietrodll pietrodll requested review from a team as code owners January 20, 2023 16:09
Copy link
Contributor

@clementgbcn clementgbcn left a comment

Choose a reason for hiding this comment

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

👍

@nkzou nkzou merged commit d006bc6 into master Jan 20, 2023
@nkzou nkzou deleted the pietrodll/security-monitoring-deprecation-warning branch January 20, 2023 19:32
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