Skip to content

Commit 8eda2cf

Browse files
[datadog_synthetics_test] Add an example for ICMP testing (#2939)
* New example * add tags in the example
1 parent 96253d9 commit 8eda2cf

File tree

4 files changed

+100
-0
lines changed

4 files changed

+100
-0
lines changed

datadog/tests/data_source_datadog_app_builder_app_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/google/uuid"
1010
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
1111
"github.com/hashicorp/terraform-plugin-testing/terraform"
12+
1213
"github.com/terraform-providers/terraform-provider-datadog/datadog/fwprovider"
1314
)
1415

datadog/tests/resource_datadog_app_builder_app_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/google/uuid"
1313
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
1414
"github.com/hashicorp/terraform-plugin-testing/terraform"
15+
1516
"github.com/terraform-providers/terraform-provider-datadog/datadog/fwprovider"
1617
"github.com/terraform-providers/terraform-provider-datadog/datadog/internal/utils"
1718
)

docs/resources/synthetics_test.md

+49
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,55 @@ resource "datadog_synthetics_test" "test_dns" {
208208
}
209209
}
210210
211+
# Example Usage (Synthetics ICMP test)
212+
# Create a new Datadog Synthetics ICMP test on example.org
213+
resource "datadog_synthetics_test" "test_api_icmp" {
214+
name = "ICMP Test on example.com"
215+
type = "api"
216+
subtype = "icmp"
217+
status = "live"
218+
locations = ["aws:eu-central-1"]
219+
tags = ["foo:bar", "foo", "env:test"]
220+
221+
request_definition {
222+
host = "example.com"
223+
no_saving_response_body = "false"
224+
number_of_packets = "1"
225+
persist_cookies = "false"
226+
should_track_hops = "false"
227+
timeout = "0"
228+
}
229+
230+
assertion {
231+
operator = "is"
232+
target = "0"
233+
type = "packetLossPercentage"
234+
}
235+
236+
assertion {
237+
operator = "lessThan"
238+
property = "avg"
239+
target = "1000"
240+
type = "latency"
241+
}
242+
243+
assertion {
244+
operator = "moreThanOrEqual"
245+
target = "1"
246+
type = "packetsReceived"
247+
}
248+
options_list {
249+
tick_every = 900
250+
retry {
251+
count = 2
252+
interval = 300
253+
}
254+
monitor_options {
255+
renotify_interval = 120
256+
}
257+
}
258+
}
259+
211260
212261
# Example Usage (Synthetics Multistep API test)
213262
# Create a new Datadog Synthetics Multistep API test

examples/resources/datadog_synthetics_test/resource.tf

+49
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,55 @@ resource "datadog_synthetics_test" "test_dns" {
167167
}
168168
}
169169

170+
# Example Usage (Synthetics ICMP test)
171+
# Create a new Datadog Synthetics ICMP test on example.org
172+
resource "datadog_synthetics_test" "test_api_icmp" {
173+
name = "ICMP Test on example.com"
174+
type = "api"
175+
subtype = "icmp"
176+
status = "live"
177+
locations = ["aws:eu-central-1"]
178+
tags = ["foo:bar", "foo", "env:test"]
179+
180+
request_definition {
181+
host = "example.com"
182+
no_saving_response_body = "false"
183+
number_of_packets = "1"
184+
persist_cookies = "false"
185+
should_track_hops = "false"
186+
timeout = "0"
187+
}
188+
189+
assertion {
190+
operator = "is"
191+
target = "0"
192+
type = "packetLossPercentage"
193+
}
194+
195+
assertion {
196+
operator = "lessThan"
197+
property = "avg"
198+
target = "1000"
199+
type = "latency"
200+
}
201+
202+
assertion {
203+
operator = "moreThanOrEqual"
204+
target = "1"
205+
type = "packetsReceived"
206+
}
207+
options_list {
208+
tick_every = 900
209+
retry {
210+
count = 2
211+
interval = 300
212+
}
213+
monitor_options {
214+
renotify_interval = 120
215+
}
216+
}
217+
}
218+
170219

171220
# Example Usage (Synthetics Multistep API test)
172221
# Create a new Datadog Synthetics Multistep API test

0 commit comments

Comments
 (0)