Skip to content

Commit fe484d2

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

File tree

7 files changed

+48
-36
lines changed

7 files changed

+48
-36
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:51.784"
2+
"spec_repo_commit": "8001cbb",
3+
"generated": "2025-08-13 20:27:09.207"
44
}
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/v2/Security-Monitoring_1187227211/Convert-a-rule-from-JSON-to-Terraform-returns-OK-response_2678697680/recording.har

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
},
99
"entries": [
1010
{
11-
"_id": "cf5cab43ffe472979a6777474c727cac",
11+
"_id": "ec4cae32d40bfc130923fab39e76bba2",
1212
"_order": 0,
1313
"cache": {},
1414
"request": {
15-
"bodySize": 432,
15+
"bodySize": 376,
1616
"cookies": [],
1717
"headers": [
1818
{
@@ -32,17 +32,17 @@
3232
"postData": {
3333
"mimeType": "application/json",
3434
"params": [],
35-
"text": "{\"cases\":[{\"condition\":\"a > 0\",\"name\":\"\",\"notifications\":[],\"status\":\"info\"}],\"filters\":[],\"isEnabled\":true,\"message\":\"Test rule\",\"name\":\"Test-Convert_a_rule_from_JSON_to_Terraform_returns_OK_response-1745494490\",\"options\":{\"evaluationWindow\":900,\"keepAlive\":3600,\"maxSignalDuration\":86400},\"queries\":[{\"aggregation\":\"count\",\"distinctFields\":[],\"groupByFields\":[],\"metric\":\"\",\"query\":\"@test:true\"}],\"tags\":[],\"type\":\"log_detection\"}"
35+
"text": "{\"cases\":[{\"condition\":\"a > 0\",\"name\":\"\",\"notifications\":[],\"status\":\"info\"}],\"filters\":[],\"isEnabled\":true,\"message\":\"Test rule\",\"name\":\"_b87eac89722bbff0\",\"options\":{\"evaluationWindow\":900,\"keepAlive\":3600,\"maxSignalDuration\":86400},\"queries\":[{\"aggregation\":\"count\",\"distinctFields\":[],\"groupByFields\":[],\"metric\":\"\",\"query\":\"@test:true\"}],\"tags\":[],\"type\":\"log_detection\"}"
3636
},
3737
"queryString": [],
3838
"url": "https://api.datadoghq.com/api/v2/security_monitoring/rules/convert"
3939
},
4040
"response": {
41-
"bodySize": 779,
41+
"bodySize": 667,
4242
"content": {
4343
"mimeType": "application/json",
44-
"size": 779,
45-
"text": "{\"terraformContent\":\"resource \\\"datadog_security_monitoring_rule\\\" \\\"test-convert_a_rule_from_json_to_terraform_returns_ok_response-1745494490\\\" {\\n\\tname = \\\"Test-Convert_a_rule_from_JSON_to_Terraform_returns_OK_response-1745494490\\\"\\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 \\u003e 0\\\"\\n\\t}\\n\\tmessage = \\\"Test rule\\\"\\n\\ttags = []\\n\\thas_extended_title = false\\n\\ttype = \\\"log_detection\\\"\\n}\\n\"}"
44+
"size": 667,
45+
"text": "{\"terraformContent\":\"resource \\\"datadog_security_monitoring_rule\\\" \\\"_b87eac89722bbff0\\\" {\\n\\tname = \\\"_b87eac89722bbff0\\\"\\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 \\u003e 0\\\"\\n\\t}\\n\\tmessage = \\\"Test rule\\\"\\n\\ttags = []\\n\\thas_extended_title = false\\n\\ttype = \\\"log_detection\\\"\\n}\\n\"}"
4646
},
4747
"cookies": [],
4848
"headers": [
@@ -57,8 +57,8 @@
5757
"status": 200,
5858
"statusText": "OK"
5959
},
60-
"startedDateTime": "2025-04-24T11:34:50.870Z",
61-
"time": 326
60+
"startedDateTime": "2025-08-13T20:13:44.195Z",
61+
"time": 406
6262
}
6363
],
6464
"pages": [],
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/v2/Security-Monitoring_1187227211/Convert-an-existing-rule-from-JSON-to-Terraform-returns-OK-response_1060662187/recording.har

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
},
99
"entries": [
1010
{
11-
"_id": "a0052e920cc51afd847925de6f328de4",
11+
"_id": "745201cb80f6ba648ed76d44e0bb9b2e",
1212
"_order": 0,
1313
"cache": {},
1414
"request": {
15-
"bodySize": 443,
15+
"bodySize": 377,
1616
"cookies": [],
1717
"headers": [
1818
{
@@ -32,17 +32,17 @@
3232
"postData": {
3333
"mimeType": "application/json",
3434
"params": [],
35-
"text": "{\"cases\":[{\"condition\":\"a > 0\",\"name\":\"\",\"notifications\":[],\"status\":\"info\"}],\"filters\":[],\"isEnabled\":true,\"message\":\"Test rule\",\"name\":\"Test-Convert_an_existing_rule_from_JSON_to_Terraform_returns_OK_response-1745494491\",\"options\":{\"evaluationWindow\":900,\"keepAlive\":3600,\"maxSignalDuration\":86400},\"queries\":[{\"aggregation\":\"count\",\"distinctFields\":[],\"groupByFields\":[],\"metrics\":[],\"query\":\"@test:true\"}],\"tags\":[],\"type\":\"log_detection\"}"
35+
"text": "{\"cases\":[{\"condition\":\"a > 0\",\"name\":\"\",\"notifications\":[],\"status\":\"info\"}],\"filters\":[],\"isEnabled\":true,\"message\":\"Test rule\",\"name\":\"_1166a375f2500467\",\"options\":{\"evaluationWindow\":900,\"keepAlive\":3600,\"maxSignalDuration\":86400},\"queries\":[{\"aggregation\":\"count\",\"distinctFields\":[],\"groupByFields\":[],\"metrics\":[],\"query\":\"@test:true\"}],\"tags\":[],\"type\":\"log_detection\"}"
3636
},
3737
"queryString": [],
3838
"url": "https://api.datadoghq.com/api/v2/security_monitoring/rules"
3939
},
4040
"response": {
41-
"bodySize": 878,
41+
"bodySize": 812,
4242
"content": {
4343
"mimeType": "application/json",
44-
"size": 878,
45-
"text": "{\"name\":\"Test-Convert_an_existing_rule_from_JSON_to_Terraform_returns_OK_response-1745494491\",\"createdAt\":1745494491502,\"isDefault\":false,\"isPartner\":false,\"isEnabled\":true,\"isBeta\":false,\"isDeleted\":false,\"isDeprecated\":false,\"queries\":[{\"query\":\"@test:true\",\"groupByFields\":[],\"hasOptionalGroupByFields\":false,\"distinctFields\":[],\"aggregation\":\"count\",\"name\":\"\",\"dataSource\":\"logs\"}],\"options\":{\"evaluationWindow\":900,\"detectionMethod\":\"threshold\",\"maxSignalDuration\":86400,\"keepAlive\":3600},\"cases\":[{\"name\":\"\",\"status\":\"info\",\"notifications\":[],\"condition\":\"a \\u003e 0\"}],\"message\":\"Test rule\",\"tags\":[],\"hasExtendedTitle\":false,\"type\":\"log_detection\",\"filters\":[],\"version\":1,\"id\":\"e60-iv6-d7e\",\"blocking\":false,\"metadata\":{\"entities\":null,\"sources\":null},\"creationAuthorId\":1445416,\"creator\":{\"handle\":\"[email protected]\",\"name\":\"frog\"},\"updater\":{\"handle\":\"\",\"name\":\"\"}}"
44+
"size": 812,
45+
"text": "{\"name\":\"_1166a375f2500467\",\"createdAt\":1755116024952,\"isDefault\":false,\"isPartner\":false,\"isEnabled\":true,\"isBeta\":false,\"isDeleted\":false,\"isDeprecated\":false,\"queries\":[{\"query\":\"@test:true\",\"groupByFields\":[],\"hasOptionalGroupByFields\":false,\"distinctFields\":[],\"aggregation\":\"count\",\"name\":\"\",\"dataSource\":\"logs\"}],\"options\":{\"evaluationWindow\":900,\"detectionMethod\":\"threshold\",\"maxSignalDuration\":86400,\"keepAlive\":3600},\"cases\":[{\"name\":\"\",\"status\":\"info\",\"notifications\":[],\"condition\":\"a \\u003e 0\"}],\"message\":\"Test rule\",\"tags\":[],\"hasExtendedTitle\":false,\"type\":\"log_detection\",\"filters\":[],\"version\":1,\"id\":\"shm-tx8-e8x\",\"blocking\":false,\"metadata\":{\"entities\":null,\"sources\":null},\"creationAuthorId\":1445416,\"creator\":{\"handle\":\"[email protected]\",\"name\":\"frog\"},\"updater\":{\"handle\":\"\",\"name\":\"\"}}"
4646
},
4747
"cookies": [],
4848
"headers": [
@@ -57,11 +57,11 @@
5757
"status": 200,
5858
"statusText": "OK"
5959
},
60-
"startedDateTime": "2025-04-24T11:34:51.210Z",
61-
"time": 373
60+
"startedDateTime": "2025-08-13T20:13:44.612Z",
61+
"time": 429
6262
},
6363
{
64-
"_id": "d9e5f4a78eaa358989873efd129df113",
64+
"_id": "9d3014a8ac0fab5730d40c2833845480",
6565
"_order": 0,
6666
"cache": {},
6767
"request": {
@@ -78,14 +78,14 @@
7878
"httpVersion": "HTTP/1.1",
7979
"method": "GET",
8080
"queryString": [],
81-
"url": "https://api.datadoghq.com/api/v2/security_monitoring/rules/e60-iv6-d7e/convert"
81+
"url": "https://api.datadoghq.com/api/v2/security_monitoring/rules/shm-tx8-e8x/convert"
8282
},
8383
"response": {
84-
"bodySize": 799,
84+
"bodySize": 667,
8585
"content": {
8686
"mimeType": "application/json",
87-
"size": 799,
88-
"text": "{\"terraformContent\":\"resource \\\"datadog_security_monitoring_rule\\\" \\\"test-convert_an_existing_rule_from_json_to_terraform_returns_ok_response-1745494491\\\" {\\n\\tname = \\\"Test-Convert_an_existing_rule_from_JSON_to_Terraform_returns_OK_response-1745494491\\\"\\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 \\u003e 0\\\"\\n\\t}\\n\\tmessage = \\\"Test rule\\\"\\n\\ttags = []\\n\\thas_extended_title = false\\n\\ttype = \\\"log_detection\\\"\\n}\\n\"}"
87+
"size": 667,
88+
"text": "{\"terraformContent\":\"resource \\\"datadog_security_monitoring_rule\\\" \\\"_1166a375f2500467\\\" {\\n\\tname = \\\"_1166a375f2500467\\\"\\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 \\u003e 0\\\"\\n\\t}\\n\\tmessage = \\\"Test rule\\\"\\n\\ttags = []\\n\\thas_extended_title = false\\n\\ttype = \\\"log_detection\\\"\\n}\\n\"}"
8989
},
9090
"cookies": [],
9191
"headers": [
@@ -100,11 +100,11 @@
100100
"status": 200,
101101
"statusText": "OK"
102102
},
103-
"startedDateTime": "2025-04-24T11:34:51.592Z",
104-
"time": 422
103+
"startedDateTime": "2025-08-13T20:13:45.047Z",
104+
"time": 397
105105
},
106106
{
107-
"_id": "453e930a3f7616fad5d28e2cc982beb0",
107+
"_id": "88a9924e5c70347ce9beb2ff15b95c10",
108108
"_order": 0,
109109
"cache": {},
110110
"request": {
@@ -121,7 +121,7 @@
121121
"httpVersion": "HTTP/1.1",
122122
"method": "DELETE",
123123
"queryString": [],
124-
"url": "https://api.datadoghq.com/api/v2/security_monitoring/rules/e60-iv6-d7e"
124+
"url": "https://api.datadoghq.com/api/v2/security_monitoring/rules/shm-tx8-e8x"
125125
},
126126
"response": {
127127
"bodySize": 0,
@@ -137,8 +137,8 @@
137137
"status": 204,
138138
"statusText": "No Content"
139139
},
140-
"startedDateTime": "2025-04-24T11:34:52.020Z",
141-
"time": 339
140+
"startedDateTime": "2025-08-13T20:13:45.449Z",
141+
"time": 434
142142
}
143143
],
144144
"pages": [],

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)