Skip to content

Commit 1b6bd64

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Fix the Convert To Terraform Cassettes (#2599)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent b5ef595 commit 1b6bd64

9 files changed

+39
-29
lines changed

.generated-info

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"spec_repo_commit": "c3e3e39",
3-
"generated": "2025-08-13 13:35:47.950"
2+
"spec_repo_commit": "8001cbb",
3+
"generated": "2025-08-13 20:27:07.288"
44
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2025-04-24T11:34:50.866Z
1+
2025-08-13T20:13:44.192Z

cassettes/features/v2/security_monitoring/Convert-a-rule-from-JSON-to-Terraform-returns-OK-response.yml

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2025-04-24T11:34:51.208Z
1+
2025-08-13T20:13:44.611Z

cassettes/features/v2/security_monitoring/Convert-an-existing-rule-from-JSON-to-Terraform-returns-OK-response.yml

Lines changed: 10 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/v2/security-monitoring/ConvertExistingSecurityMonitoringRule.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
require "datadog_api_client"
44
api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new
55

6-
# there is a valid "security_rule" in the system
7-
SECURITY_RULE_ID = ENV["SECURITY_RULE_ID"]
8-
p api_instance.convert_existing_security_monitoring_rule(SECURITY_RULE_ID)
6+
# there is a valid "security_rule_hash" in the system
7+
SECURITY_RULE_HASH_ID = ENV["SECURITY_RULE_HASH_ID"]
8+
p api_instance.convert_existing_security_monitoring_rule(SECURITY_RULE_HASH_ID)

examples/v2/security-monitoring/ConvertSecurityMonitoringRuleFromJSONToTerraform.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new
55

66
body = DatadogAPIClient::V2::SecurityMonitoringStandardRulePayload.new({
7-
name: "Example-Security-Monitoring",
7+
name: "_49768568946de993",
88
queries: [
99
DatadogAPIClient::V2::SecurityMonitoringStandardRuleQuery.new({
1010
query: "@test:true",

features/v2/given.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,18 @@
804804
"tag": "Security Monitoring",
805805
"operationId": "CreateSecurityMonitoringRule"
806806
},
807+
{
808+
"parameters": [
809+
{
810+
"name": "body",
811+
"value": "{\n \"name\": \"_{{ unique_hash }}\",\n \"queries\": [{\n \"query\": \"@test:true\",\n \"aggregation\": \"count\",\n \"groupByFields\": [],\n \"distinctFields\": [],\n \"metrics\": []\n }],\n \"filters\": [],\n \"cases\": [{\n \"name\": \"\",\n \"status\": \"info\",\n \"condition\": \"a > 0\",\n \"notifications\": []\n }],\n \"options\": {\n \"evaluationWindow\": 900,\n \"keepAlive\": 3600,\n \"maxSignalDuration\": 86400\n },\n \"message\": \"Test rule\",\n \"tags\": [],\n \"isEnabled\": true,\n \"type\": \"log_detection\"\n}"
812+
}
813+
],
814+
"step": "there is a valid \"security_rule_hash\" in the system",
815+
"key": "security_rule_hash",
816+
"tag": "Security Monitoring",
817+
"operationId": "CreateSecurityMonitoringRule"
818+
},
807819
{
808820
"step": "a valid \"configuration\" in the system",
809821
"key": "configuration",

features/v2/security_monitoring.feature

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ Feature: Security Monitoring
132132
@team:DataDog/k9-cloud-security-platform
133133
Scenario: Convert a rule from JSON to Terraform returns "OK" response
134134
Given new "ConvertSecurityMonitoringRuleFromJSONToTerraform" request
135-
And body with value {"name":"{{ unique }}", "queries":[{"query":"@test:true","aggregation":"count","groupByFields":[],"distinctFields":[],"metric":""}],"filters":[],"cases":[{"name":"","status":"info","condition":"a > 0","notifications":[]}],"options":{"evaluationWindow":900,"keepAlive":3600,"maxSignalDuration":86400},"message":"Test rule","tags":[],"isEnabled":true, "type":"log_detection"}
135+
And body with value {"name":"_{{ unique_hash }}", "queries":[{"query":"@test:true","aggregation":"count","groupByFields":[],"distinctFields":[],"metric":""}],"filters":[],"cases":[{"name":"","status":"info","condition":"a > 0","notifications":[]}],"options":{"evaluationWindow":900,"keepAlive":3600,"maxSignalDuration":86400},"message":"Test rule","tags":[],"isEnabled":true, "type":"log_detection"}
136136
When the request is sent
137137
Then the response status is 200 OK
138-
And the response "terraformContent" is equal to "resource \"datadog_security_monitoring_rule\" \"{{ unique_lower }}\" {\n\tname = \"{{ unique }}\"\n\tenabled = true\n\tquery {\n\t\tquery = \"@test:true\"\n\t\tgroup_by_fields = []\n\t\tdistinct_fields = []\n\t\taggregation = \"count\"\n\t\tname = \"\"\n\t\tdata_source = \"logs\"\n\t}\n\toptions {\n\t\tkeep_alive = 3600\n\t\tmax_signal_duration = 86400\n\t\tdetection_method = \"threshold\"\n\t\tevaluation_window = 900\n\t}\n\tcase {\n\t\tname = \"\"\n\t\tstatus = \"info\"\n\t\tnotifications = []\n\t\tcondition = \"a > 0\"\n\t}\n\tmessage = \"Test rule\"\n\ttags = []\n\thas_extended_title = false\n\ttype = \"log_detection\"\n}\n"
138+
And the response "terraformContent" is equal to "resource \"datadog_security_monitoring_rule\" \"_{{ unique_hash }}\" {\n\tname = \"_{{ unique_hash }}\"\n\tenabled = true\n\tquery {\n\t\tquery = \"@test:true\"\n\t\tgroup_by_fields = []\n\t\tdistinct_fields = []\n\t\taggregation = \"count\"\n\t\tname = \"\"\n\t\tdata_source = \"logs\"\n\t}\n\toptions {\n\t\tkeep_alive = 3600\n\t\tmax_signal_duration = 86400\n\t\tdetection_method = \"threshold\"\n\t\tevaluation_window = 900\n\t}\n\tcase {\n\t\tname = \"\"\n\t\tstatus = \"info\"\n\t\tnotifications = []\n\t\tcondition = \"a > 0\"\n\t}\n\tmessage = \"Test rule\"\n\ttags = []\n\thas_extended_title = false\n\ttype = \"log_detection\"\n}\n"
139139

140140
@skip @team:DataDog/k9-cloud-security-platform
141141
Scenario: Convert an existing rule from JSON to Terraform returns "Bad Request" response
@@ -154,11 +154,11 @@ Feature: Security Monitoring
154154
@team:DataDog/k9-cloud-security-platform
155155
Scenario: Convert an existing rule from JSON to Terraform returns "OK" response
156156
Given new "ConvertExistingSecurityMonitoringRule" request
157-
And there is a valid "security_rule" in the system
158-
And request contains "rule_id" parameter from "security_rule.id"
157+
And there is a valid "security_rule_hash" in the system
158+
And request contains "rule_id" parameter from "security_rule_hash.id"
159159
When the request is sent
160160
Then the response status is 200 OK
161-
And the response "terraformContent" is equal to "resource \"datadog_security_monitoring_rule\" \"{{ unique_lower }}\" {\n\tname = \"{{ unique }}\"\n\tenabled = true\n\tquery {\n\t\tquery = \"@test:true\"\n\t\tgroup_by_fields = []\n\t\tdistinct_fields = []\n\t\taggregation = \"count\"\n\t\tname = \"\"\n\t\tdata_source = \"logs\"\n\t}\n\toptions {\n\t\tkeep_alive = 3600\n\t\tmax_signal_duration = 86400\n\t\tdetection_method = \"threshold\"\n\t\tevaluation_window = 900\n\t}\n\tcase {\n\t\tname = \"\"\n\t\tstatus = \"info\"\n\t\tnotifications = []\n\t\tcondition = \"a > 0\"\n\t}\n\tmessage = \"Test rule\"\n\ttags = []\n\thas_extended_title = false\n\ttype = \"log_detection\"\n}\n"
161+
And the response "terraformContent" is equal to "resource \"datadog_security_monitoring_rule\" \"_{{ unique_hash }}\" {\n\tname = \"_{{ unique_hash }}\"\n\tenabled = true\n\tquery {\n\t\tquery = \"@test:true\"\n\t\tgroup_by_fields = []\n\t\tdistinct_fields = []\n\t\taggregation = \"count\"\n\t\tname = \"\"\n\t\tdata_source = \"logs\"\n\t}\n\toptions {\n\t\tkeep_alive = 3600\n\t\tmax_signal_duration = 86400\n\t\tdetection_method = \"threshold\"\n\t\tevaluation_window = 900\n\t}\n\tcase {\n\t\tname = \"\"\n\t\tstatus = \"info\"\n\t\tnotifications = []\n\t\tcondition = \"a > 0\"\n\t}\n\tmessage = \"Test rule\"\n\ttags = []\n\thas_extended_title = false\n\ttype = \"log_detection\"\n}\n"
162162

163163
@skip-validation @team:DataDog/k9-cloud-security-platform
164164
Scenario: Create a cloud_configuration rule returns "OK" response

0 commit comments

Comments
 (0)