From d507c850190a7f029a37c18a7fcb989fef96a21e Mon Sep 17 00:00:00 2001 From: Katia SHANG Date: Wed, 1 Oct 2025 14:31:04 +0200 Subject: [PATCH 1/4] add blockedRequestPatterns Signed-off-by: Katia SHANG --- datadog/resource_datadog_synthetics_test_.go | 15 +++++++++++++++ docs/resources/synthetics_test.md | 1 + 2 files changed, 16 insertions(+) diff --git a/datadog/resource_datadog_synthetics_test_.go b/datadog/resource_datadog_synthetics_test_.go index eadd637b77..f659e0b879 100644 --- a/datadog/resource_datadog_synthetics_test_.go +++ b/datadog/resource_datadog_synthetics_test_.go @@ -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(), }, }, @@ -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{}) { @@ -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 diff --git a/docs/resources/synthetics_test.md b/docs/resources/synthetics_test.md index 9885925ef5..7f6ddea6e7 100644 --- a/docs/resources/synthetics_test.md +++ b/docs/resources/synthetics_test.md @@ -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` (String List) 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 From 11e3f91515c86c334a8247714efffee2561d1edd Mon Sep 17 00:00:00 2001 From: Katia SHANG Date: Wed, 1 Oct 2025 19:05:48 +0200 Subject: [PATCH 2/4] update tests Signed-off-by: Katia SHANG --- datadog/tests/resource_datadog_synthetics_test_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/datadog/tests/resource_datadog_synthetics_test_test.go b/datadog/tests/resource_datadog_synthetics_test_test.go index a41d35d10e..6d9251080a 100644 --- a/datadog/tests/resource_datadog_synthetics_test_test.go +++ b/datadog/tests/resource_datadog_synthetics_test_test.go @@ -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 @@ -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 @@ -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( @@ -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" From 86a8ef90e4ba124cf5ce8b81b3e7f24bde324dbd Mon Sep 17 00:00:00 2001 From: Katia SHANG Date: Thu, 2 Oct 2025 17:03:24 +0200 Subject: [PATCH 3/4] update client Signed-off-by: Katia SHANG --- datadog/resource_datadog_synthetics_test_.go | 28 ++++++++++---------- go.mod | 2 +- go.sum | 4 +-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/datadog/resource_datadog_synthetics_test_.go b/datadog/resource_datadog_synthetics_test_.go index f659e0b879..415f162c6e 100644 --- a/datadog/resource_datadog_synthetics_test_.go +++ b/datadog/resource_datadog_synthetics_test_.go @@ -867,14 +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, - }, - }, + "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(), }, }, @@ -4348,9 +4348,9 @@ 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 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 @@ -4495,9 +4495,9 @@ func buildTerraformTestOptions(actualOptions datadogV1.SyntheticsTestOptions) [] if actualOptions.HasInitialNavigationTimeout() { localOptionsList["initial_navigation_timeout"] = actualOptions.GetInitialNavigationTimeout() } - if actualOptions.HasBlockedRequestPatterns() { - localOptionsList["blockedRequestPatterns"] = actualOptions.GetBlockedRequestPatterns() - } + if actualOptions.HasBlockedRequestPatterns() { + localOptionsList["blockedRequestPatterns"] = actualOptions.GetBlockedRequestPatterns() + } localOptionsLists := make([]map[string]interface{}, 1) localOptionsLists[0] = localOptionsList diff --git a/go.mod b/go.mod index a311affc23..92c9b42fec 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 1a57df4d0b..4b2f70a10c 100644 --- a/go.sum +++ b/go.sum @@ -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= From b6ab68fac0b04dfe2c5539d4738bf456cc6514dc Mon Sep 17 00:00:00 2001 From: Katia SHANG Date: Tue, 7 Oct 2025 18:54:47 +0200 Subject: [PATCH 4/4] update docs Signed-off-by: Katia SHANG --- docs/resources/synthetics_test.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/resources/synthetics_test.md b/docs/resources/synthetics_test.md index 7f6ddea6e7..2da805c11f 100644 --- a/docs/resources/synthetics_test.md +++ b/docs/resources/synthetics_test.md @@ -1441,7 +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` (String List) Blocked URL patterns. Requests made to URLs matching any of the patterns listed here will be blocked. +- `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