Skip to content

Commit 0e42677

Browse files
nkzouJordanP
andauthored
[datadog_synthetics_test] Add missing disable_cors option (#1605)
* [datadog_synthetics_test] Add missing disable_cors option * Fix indent * make docs * Add recorded cassettes Co-authored-by: Jordan Pittier <[email protected]>
1 parent eb19d0d commit 0e42677

11 files changed

+110
-92
lines changed

datadog/resource_datadog_synthetics_test_.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,11 @@ func syntheticsTestOptionsList() *schema.Schema {
583583
Type: schema.TypeBool,
584584
Optional: true,
585585
},
586+
"disable_cors": {
587+
Description: "Disable Cross-Origin Resource Sharing for browser tests.",
588+
Type: schema.TypeBool,
589+
Optional: true,
590+
},
586591
"initial_navigation_timeout": {
587592
Description: "Timeout before declaring the initial step as failed (in seconds) for browser tests.",
588593
Type: schema.TypeInt,
@@ -1934,6 +1939,10 @@ func buildSyntheticsBrowserTestStruct(d *schema.ResourceData) *datadogV1.Synthet
19341939
options.SetDisableCsp(disableCsp.(bool))
19351940
}
19361941

1942+
if disableCors, ok := d.GetOk("options_list.0.disable_cors"); ok {
1943+
options.SetDisableCors(disableCors.(bool))
1944+
}
1945+
19371946
if initialNavigationTimeout, ok := d.GetOk("options_list.0.initial_navigation_timeout"); ok {
19381947
options.SetInitialNavigationTimeout(int64(initialNavigationTimeout.(int)))
19391948
}
@@ -2433,6 +2442,9 @@ func updateSyntheticsBrowserTestLocalState(d *schema.ResourceData, syntheticsTes
24332442
if actualOptions.HasDisableCsp() {
24342443
localOptionsList["disable_csp"] = actualOptions.GetDisableCsp()
24352444
}
2445+
if actualOptions.HasDisableCors() {
2446+
localOptionsList["disable_cors"] = actualOptions.GetDisableCors()
2447+
}
24362448
if actualOptions.HasInitialNavigationTimeout() {
24372449
localOptionsList["initial_navigation_timeout"] = actualOptions.GetInitialNavigationTimeout()
24382450
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-09-06T21:35:16.447324+02:00
1+
2022-10-19T09:52:38.20238-04:00

datadog/tests/cassettes/TestAccDatadogSyntheticsBrowserTest_Basic.yaml

Lines changed: 15 additions & 15 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-09-06T21:36:32.913866+02:00
1+
2022-10-19T09:52:06.698853-04:00

datadog/tests/cassettes/TestAccDatadogSyntheticsBrowserTest_Updated.yaml

Lines changed: 29 additions & 28 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-09-06T21:36:51.410685+02:00
1+
2022-10-19T09:52:06.698853-04:00

datadog/tests/cassettes/TestAccDatadogSyntheticsBrowserTest_Updated_RumSettings.yaml

Lines changed: 29 additions & 28 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-09-06T21:36:03.671229+02:00
1+
2022-10-19T09:52:56.69711-04:00

datadog/tests/cassettes/TestAccDatadogSyntheticsBrowserTest_importBasic.yaml

Lines changed: 17 additions & 17 deletions
Large diffs are not rendered by default.

datadog/tests/resource_datadog_synthetics_test_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2229,6 +2229,8 @@ func createSyntheticsBrowserTestStep(ctx context.Context, accProvider func() (*s
22292229
"datadog_synthetics_test.bar", "options_list.0.ignore_server_certificate_error", "true"),
22302230
resource.TestCheckResourceAttr(
22312231
"datadog_synthetics_test.bar", "options_list.0.disable_csp", "true"),
2232+
resource.TestCheckResourceAttr(
2233+
"datadog_synthetics_test.bar", "options_list.0.disable_cors", "true"),
22322234
resource.TestCheckResourceAttr(
22332235
"datadog_synthetics_test.bar", "options_list.0.initial_navigation_timeout", "150"),
22342236
resource.TestCheckResourceAttr(
@@ -2342,6 +2344,7 @@ resource "datadog_synthetics_test" "bar" {
23422344
23432345
ignore_server_certificate_error = true
23442346
disable_csp = true
2347+
disable_cors = true
23452348
initial_navigation_timeout = 150
23462349
}
23472350

docs/resources/synthetics_test.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ Optional:
618618
- `allow_insecure` (Boolean) Allows loading insecure content for an HTTP test.
619619
- `check_certificate_revocation` (Boolean) For SSL test, whether or not the test should fail on revoked certificate in stapled OCSP.
620620
- `ci` (Block List, Max: 1) CI/CD options for a Synthetic test. (see [below for nested schema](#nestedblock--options_list--ci))
621+
- `disable_cors` (Boolean) Disable Cross-Origin Resource Sharing for browser tests.
621622
- `disable_csp` (Boolean) Disable Content Security Policy for browser tests.
622623
- `follow_redirects` (Boolean) Determines whether or not the API HTTP test should follow redirects.
623624
- `ignore_server_certificate_error` (Boolean) Ignore server certificate error.

0 commit comments

Comments
 (0)