Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions datadog/resource_datadog_synthetics_test_.go
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,14 @@ func syntheticsTestOptionsList() *schema.Schema {
Type: schema.TypeInt,
Optional: true,
},
"blocked_request_patterns": {
Description: "Blocked URL patterns. Requests made to URLs matching any of the patterns listed here will be blocked.",
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"http_version": syntheticsHttpVersionOption(),
},
},
Expand Down Expand Up @@ -4340,6 +4348,10 @@ func buildDatadogTestOptions(d *schema.ResourceData) *datadogV1.SyntheticsTestOp
options.SetInitialNavigationTimeout(int64(initialNavigationTimeout.(int)))
}

if blockedRequestPatterns, ok := d.GetOk("options_list.0.blocked_request_patterns"); ok {
options.SetBlockedRequestPatterns(blockedRequestPatterns.([]string))
}

if attr, ok := d.GetOk("device_ids"); ok {
var deviceIds []string
for _, s := range attr.([]interface{}) {
Expand Down Expand Up @@ -4483,6 +4495,9 @@ func buildTerraformTestOptions(actualOptions datadogV1.SyntheticsTestOptions) []
if actualOptions.HasInitialNavigationTimeout() {
localOptionsList["initial_navigation_timeout"] = actualOptions.GetInitialNavigationTimeout()
}
if actualOptions.HasBlockedRequestPatterns() {
localOptionsList["blockedRequestPatterns"] = actualOptions.GetBlockedRequestPatterns()
}

localOptionsLists := make([]map[string]interface{}, 1)
localOptionsLists[0] = localOptionsList
Expand Down
7 changes: 7 additions & 0 deletions datadog/tests/resource_datadog_synthetics_test_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,7 @@ resource "datadog_synthetics_test" "test" {

options_list {
initial_navigation_timeout = 15
blocked_request_patterns = ["https://example.com/*"]
tick_every = 3600
retry {
count = 0
Expand Down Expand Up @@ -970,6 +971,7 @@ resource "datadog_synthetics_test" "test" {

options_list {
initial_navigation_timeout = 15
blocked_request_patterns = ["https://example.com/*"]
tick_every = 3600
retry {
count = 0
Expand Down Expand Up @@ -4032,6 +4034,10 @@ func createSyntheticsBrowserTestStep(ctx context.Context, accProvider *schema.Pr
"datadog_synthetics_test.bar", "options_list.0.disable_cors", "true"),
resource.TestCheckResourceAttr(
"datadog_synthetics_test.bar", "options_list.0.initial_navigation_timeout", "150"),
resource.TestCheckResourceAttr(
"datadog_synthetics_test.bar", "options_list.0.blocked_request_patterns.#", "1"),
resource.TestCheckResourceAttr(
"datadog_synthetics_test.bar", "options_list.0.blocked_request_patterns.0", "https://example.com/*"),
resource.TestCheckResourceAttr(
"datadog_synthetics_test.bar", "name", testName),
resource.TestCheckResourceAttr(
Expand Down Expand Up @@ -4172,6 +4178,7 @@ resource "datadog_synthetics_test" "bar" {
disable_csp = true
disable_cors = true
initial_navigation_timeout = 150
blocked_request_patterns = ["https://example.com/*"]
}

name = "%[1]s"
Expand Down
1 change: 1 addition & 0 deletions docs/resources/synthetics_test.md
Original file line number Diff line number Diff line change
Expand Up @@ -1441,6 +1441,7 @@ Optional:

- `accept_self_signed` (Boolean) For SSL tests, whether or not the test should allow self signed certificates.
- `allow_insecure` (Boolean) Allows loading insecure content for a request in an API test or in a multistep API test step.
- `blocked_request_patterns` (List of String) Blocked URL patterns. Requests made to URLs matching any of the patterns listed here will be blocked.
- `check_certificate_revocation` (Boolean) For SSL tests, whether or not the test should fail on revoked certificate in stapled OCSP.
- `ci` (Block List, Max: 1) CI/CD options for a Synthetic test. (see [below for nested schema](#nestedblock--options_list--ci))
- `disable_aia_intermediate_fetching` (Boolean) For SSL tests, whether or not the test should disable fetching intermediate certificates from AIA
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/terraform-providers/terraform-provider-datadog

require (
github.com/DataDog/datadog-api-client-go/v2 v2.47.0
github.com/DataDog/datadog-api-client-go/v2 v2.47.1-0.20251002133952-772851d54caa
github.com/DataDog/dd-sdk-go-testing v0.0.0-20211116174033-1cd082e322ad
github.com/Masterminds/semver/v3 v3.3.1
github.com/google/go-cmp v0.7.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/DataDog/datadog-api-client-go/v2 v2.47.0 h1:bhPu0F6BGUGBaDw4h576asJcffFatYufy8w3/39prqA=
github.com/DataDog/datadog-api-client-go/v2 v2.47.0/go.mod h1:d3tOEgUd2kfsr9uuHQdY+nXrWp4uikgTgVCPdKNK30U=
github.com/DataDog/datadog-api-client-go/v2 v2.47.1-0.20251002133952-772851d54caa h1:Go4bOZ3uslzTEIohbndaF0g7MqUqfT4jcuh6CYKK/70=
github.com/DataDog/datadog-api-client-go/v2 v2.47.1-0.20251002133952-772851d54caa/go.mod h1:d3tOEgUd2kfsr9uuHQdY+nXrWp4uikgTgVCPdKNK30U=
github.com/DataDog/datadog-go v4.4.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/datadog-go v4.8.3+incompatible h1:fNGaYSuObuQb5nzeTQqowRAd9bpDIRRV4/gUtIBjh8Q=
github.com/DataDog/datadog-go v4.8.3+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
Expand Down
Loading