diff --git a/datadog/cassettes/TestAccDatadogSyntheticsGlobalVariableSecure_Basic.freeze b/datadog/cassettes/TestAccDatadogSyntheticsGlobalVariableSecure_Basic.freeze new file mode 100644 index 0000000000..7e7a25b418 --- /dev/null +++ b/datadog/cassettes/TestAccDatadogSyntheticsGlobalVariableSecure_Basic.freeze @@ -0,0 +1 @@ +2020-11-23T12:12:59.239538+01:00 \ No newline at end of file diff --git a/datadog/cassettes/TestAccDatadogSyntheticsGlobalVariableSecure_Basic.yaml b/datadog/cassettes/TestAccDatadogSyntheticsGlobalVariableSecure_Basic.yaml new file mode 100644 index 0000000000..786274ed7b --- /dev/null +++ b/datadog/cassettes/TestAccDatadogSyntheticsGlobalVariableSecure_Basic.yaml @@ -0,0 +1,435 @@ +--- +version: 1 +interactions: +- request: + body: | + {"description":"a secure global variable","name":"TF_TESTACCDATADOGSYNTHETICSGLOBALVARIABLESECURE_BASIC_LOCAL_1606129979","tags":["foo:bar","baz"],"value":{"secure":true,"value":"variable-secure-value"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + Dd-Operation-Id: + - CreateGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "1642699028776452346" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7785615446812149514" + url: https://api.datadoghq.com/api/v1/synthetics/variables + method: POST + response: + body: '{"parse_test_extracted_at":null,"description":"a secure global variable","tags":["foo:bar","baz"],"parse_test_public_id":null,"value":{"secure":true},"id":"246d48e0-07bf-4538-8c04-4de22f627df9","parse_test_options":null,"name":"TF_TESTACCDATADOGSYNTHETICSGLOBALVARIABLESECURE_BASIC_LOCAL_1606129979","parse_test_name":null,"type":"variable"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:00 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Mon, 30-Nov-2020 11:12:59 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - 1rlggRfE73pEFFllgZfChM1RZODDnKFUyVMEk3an2/a5+lJByU7Porp1iIMqRaO7 + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "119" + X-Ratelimit-Reset: + - "1" + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "769463645803916130" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7785615446812149514" + url: https://api.datadoghq.com/api/v1/synthetics/variables/246d48e0-07bf-4538-8c04-4de22f627df9 + method: GET + response: + body: '{"parse_test_extracted_at":null,"description":"a secure global variable","tags":["foo:bar","baz"],"parse_test_public_id":null,"value":{"secure":true},"id":"246d48e0-07bf-4538-8c04-4de22f627df9","parse_test_options":null,"name":"TF_TESTACCDATADOGSYNTHETICSGLOBALVARIABLESECURE_BASIC_LOCAL_1606129979","created_at":"2020-11-23T11:12:59.778890+00:00","modified_at":"2020-11-23T11:12:59.778890+00:00","created_by":1445416,"parse_test_name":null,"type":"variable"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:00 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Mon, 30-Nov-2020 11:13:00 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - SjSxykLY0gTr3VkJbxmjvoevebB2pxQifq0h5HklwYksG7/9u16HyBsdYlpi9mGW + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "119" + X-Ratelimit-Reset: + - "60" + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "3863968111697697380" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7785615446812149514" + url: https://api.datadoghq.com/api/v1/synthetics/variables/246d48e0-07bf-4538-8c04-4de22f627df9 + method: GET + response: + body: '{"parse_test_extracted_at":null,"description":"a secure global variable","tags":["foo:bar","baz"],"parse_test_public_id":null,"value":{"secure":true},"id":"246d48e0-07bf-4538-8c04-4de22f627df9","parse_test_options":null,"name":"TF_TESTACCDATADOGSYNTHETICSGLOBALVARIABLESECURE_BASIC_LOCAL_1606129979","created_at":"2020-11-23T11:12:59.778890+00:00","modified_at":"2020-11-23T11:12:59.778890+00:00","created_by":1445416,"parse_test_name":null,"type":"variable"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:01 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Mon, 30-Nov-2020 11:13:01 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - h/IXnJS1M5zKHh5ujv7CkNFB4pqHSDVrmy+nI86u4Ciy2MfrEYtp+07i0sugqnf8 + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "118" + X-Ratelimit-Reset: + - "59" + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "821194375031265781" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7785615446812149514" + url: https://api.datadoghq.com/api/v1/synthetics/variables/246d48e0-07bf-4538-8c04-4de22f627df9 + method: GET + response: + body: '{"parse_test_extracted_at":null,"description":"a secure global variable","tags":["foo:bar","baz"],"parse_test_public_id":null,"value":{"secure":true},"id":"246d48e0-07bf-4538-8c04-4de22f627df9","parse_test_options":null,"name":"TF_TESTACCDATADOGSYNTHETICSGLOBALVARIABLESECURE_BASIC_LOCAL_1606129979","created_at":"2020-11-23T11:12:59.778890+00:00","modified_at":"2020-11-23T11:12:59.778890+00:00","created_by":1445416,"parse_test_name":null,"type":"variable"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:01 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Mon, 30-Nov-2020 11:13:01 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - QgQu/iPnCQXRgWPQKBm0M4xipFcbwl50MnRHSjKNayyZv/6KjuJNpOhY5+udaeL8 + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "117" + X-Ratelimit-Reset: + - "59" + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "3773820733578388672" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7785615446812149514" + url: https://api.datadoghq.com/api/v1/synthetics/variables/246d48e0-07bf-4538-8c04-4de22f627df9 + method: GET + response: + body: '{"parse_test_extracted_at":null,"description":"a secure global variable","tags":["foo:bar","baz"],"parse_test_public_id":null,"value":{"secure":true},"id":"246d48e0-07bf-4538-8c04-4de22f627df9","parse_test_options":null,"name":"TF_TESTACCDATADOGSYNTHETICSGLOBALVARIABLESECURE_BASIC_LOCAL_1606129979","created_at":"2020-11-23T11:12:59.778890+00:00","modified_at":"2020-11-23T11:12:59.778890+00:00","created_by":1445416,"parse_test_name":null,"type":"variable"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:01 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Mon, 30-Nov-2020 11:13:01 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - V26KHlc/RfdWahgILvghYzp00rgLN6YCNAgg+V0KrlqUWK5TouaimNqGpGYzd/eX + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "116" + X-Ratelimit-Reset: + - "59" + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - DeleteGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "7858829843741932542" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7785615446812149514" + url: https://api.datadoghq.com/api/v1/synthetics/variables/246d48e0-07bf-4538-8c04-4de22f627df9 + method: DELETE + response: + body: "null" + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Length: + - "4" + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:02 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Mon, 30-Nov-2020 11:13:01 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - bCBSaf0t3cWhIJuGOGz9PtbBY7MrMPu1HpZVAposegdxNlFMe/qHi/UbtNAIVmzS + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "119" + X-Ratelimit-Reset: + - "59" + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "1334884201595165685" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7785615446812149514" + url: https://api.datadoghq.com/api/v1/synthetics/variables/246d48e0-07bf-4538-8c04-4de22f627df9 + method: GET + response: + body: '{"errors": ["Synthetics variable not found"]}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:02 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "115" + X-Ratelimit-Reset: + - "58" + status: 404 Not Found + code: 404 + duration: "" diff --git a/datadog/cassettes/TestAccDatadogSyntheticsGlobalVariableSecure_Updated.freeze b/datadog/cassettes/TestAccDatadogSyntheticsGlobalVariableSecure_Updated.freeze new file mode 100644 index 0000000000..685a88dd2a --- /dev/null +++ b/datadog/cassettes/TestAccDatadogSyntheticsGlobalVariableSecure_Updated.freeze @@ -0,0 +1 @@ +2020-11-23T12:13:53.86289+01:00 \ No newline at end of file diff --git a/datadog/cassettes/TestAccDatadogSyntheticsGlobalVariableSecure_Updated.yaml b/datadog/cassettes/TestAccDatadogSyntheticsGlobalVariableSecure_Updated.yaml new file mode 100644 index 0000000000..a5502b335b --- /dev/null +++ b/datadog/cassettes/TestAccDatadogSyntheticsGlobalVariableSecure_Updated.yaml @@ -0,0 +1,753 @@ +--- +version: 1 +interactions: +- request: + body: | + {"description":"a secure global variable","name":"TF_TESTACCDATADOGSYNTHETICSGLOBALVARIABLESECURE_UPDATED_LOCAL_1606130033","tags":["foo:bar","baz"],"value":{"secure":true,"value":"variable-secure-value"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + Dd-Operation-Id: + - CreateGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "6651921517648596718" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7652819193922499617" + url: https://api.datadoghq.com/api/v1/synthetics/variables + method: POST + response: + body: '{"parse_test_extracted_at":null,"description":"a secure global variable","tags":["foo:bar","baz"],"parse_test_public_id":null,"value":{"secure":true},"id":"582758e2-bc3b-4eff-aeb9-96a6dd46aef2","parse_test_options":null,"name":"TF_TESTACCDATADOGSYNTHETICSGLOBALVARIABLESECURE_UPDATED_LOCAL_1606130033","parse_test_name":null,"type":"variable"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:55 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Mon, 30-Nov-2020 11:13:54 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - F+MB1uJtICegWSQGMRxkng/mFaS+IzSp7MVdNCMxEuNz7Df8CVcsilcdpPZyVGTp + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "119" + X-Ratelimit-Reset: + - "6" + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "7319370717959256025" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7652819193922499617" + url: https://api.datadoghq.com/api/v1/synthetics/variables/582758e2-bc3b-4eff-aeb9-96a6dd46aef2 + method: GET + response: + body: '{"parse_test_extracted_at":null,"description":"a secure global variable","tags":["foo:bar","baz"],"parse_test_public_id":null,"value":{"secure":true},"id":"582758e2-bc3b-4eff-aeb9-96a6dd46aef2","parse_test_options":null,"name":"TF_TESTACCDATADOGSYNTHETICSGLOBALVARIABLESECURE_UPDATED_LOCAL_1606130033","created_at":"2020-11-23T11:13:54.399494+00:00","modified_at":"2020-11-23T11:13:54.399494+00:00","created_by":1445416,"parse_test_name":null,"type":"variable"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:55 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Mon, 30-Nov-2020 11:13:55 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - s0LsNvQsMm21RUzMLDODd6jiqqojzRfEoHLrnASSfK5zaa+QnpY16tmznkR4zVSs + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "114" + X-Ratelimit-Reset: + - "5" + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "4929326586656662371" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7652819193922499617" + url: https://api.datadoghq.com/api/v1/synthetics/variables/582758e2-bc3b-4eff-aeb9-96a6dd46aef2 + method: GET + response: + body: '{"parse_test_extracted_at":null,"description":"a secure global variable","tags":["foo:bar","baz"],"parse_test_public_id":null,"value":{"secure":true},"id":"582758e2-bc3b-4eff-aeb9-96a6dd46aef2","parse_test_options":null,"name":"TF_TESTACCDATADOGSYNTHETICSGLOBALVARIABLESECURE_UPDATED_LOCAL_1606130033","created_at":"2020-11-23T11:13:54.399494+00:00","modified_at":"2020-11-23T11:13:54.399494+00:00","created_by":1445416,"parse_test_name":null,"type":"variable"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:55 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Mon, 30-Nov-2020 11:13:55 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - 35J49GdWRZ44BXWQv5M8k5DMOKDsnUL/+b8VnKl01OT828ngNdfZvXJ9jRXKLHFA + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "113" + X-Ratelimit-Reset: + - "5" + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "2451451326135529497" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7652819193922499617" + url: https://api.datadoghq.com/api/v1/synthetics/variables/582758e2-bc3b-4eff-aeb9-96a6dd46aef2 + method: GET + response: + body: '{"parse_test_extracted_at":null,"description":"a secure global variable","tags":["foo:bar","baz"],"parse_test_public_id":null,"value":{"secure":true},"id":"582758e2-bc3b-4eff-aeb9-96a6dd46aef2","parse_test_options":null,"name":"TF_TESTACCDATADOGSYNTHETICSGLOBALVARIABLESECURE_UPDATED_LOCAL_1606130033","created_at":"2020-11-23T11:13:54.399494+00:00","modified_at":"2020-11-23T11:13:54.399494+00:00","created_by":1445416,"parse_test_name":null,"type":"variable"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:55 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Mon, 30-Nov-2020 11:13:55 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - 92/tpeRQ0by9nn7WsSPyVyXsoLNu8gimYih2BuL6sJV2amfIFPaN8R5eGATyWG3E + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "112" + X-Ratelimit-Reset: + - "5" + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "3011066993608962453" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7652819193922499617" + url: https://api.datadoghq.com/api/v1/synthetics/variables/582758e2-bc3b-4eff-aeb9-96a6dd46aef2 + method: GET + response: + body: '{"parse_test_extracted_at":null,"description":"a secure global variable","tags":["foo:bar","baz"],"parse_test_public_id":null,"value":{"secure":true},"id":"582758e2-bc3b-4eff-aeb9-96a6dd46aef2","parse_test_options":null,"name":"TF_TESTACCDATADOGSYNTHETICSGLOBALVARIABLESECURE_UPDATED_LOCAL_1606130033","created_at":"2020-11-23T11:13:54.399494+00:00","modified_at":"2020-11-23T11:13:54.399494+00:00","created_by":1445416,"parse_test_name":null,"type":"variable"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:55 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Mon, 30-Nov-2020 11:13:55 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - amxMFAqiSVjNyNv9bH0oCnBEjAVk4yOIMrMQTyRWQ0WFa2JUcjQXHejBMO8Fj7RQ + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "111" + X-Ratelimit-Reset: + - "5" + status: 200 OK + code: 200 + duration: "" +- request: + body: | + {"description":"an updated secure global variable","name":"TF_TESTACCDATADOGSYNTHETICSGLOBALVARIABLESECURE_UPDATED_LOCAL_1606130033_UPDATED","tags":["foo:bar","baz","env:test"],"value":{"secure":true,"value":"variable-secure-value-updated"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + Dd-Operation-Id: + - EditGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "3219229678624038482" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7652819193922499617" + url: https://api.datadoghq.com/api/v1/synthetics/variables/582758e2-bc3b-4eff-aeb9-96a6dd46aef2 + method: PUT + response: + body: '{"parse_test_extracted_at":null,"description":"an updated secure global + variable","tags":["foo:bar","baz","env:test"],"parse_test_public_id":null,"value":{"secure":true},"id":"582758e2-bc3b-4eff-aeb9-96a6dd46aef2","parse_test_options":null,"name":"TF_TESTACCDATADOGSYNTHETICSGLOBALVARIABLESECURE_UPDATED_LOCAL_1606130033_UPDATED","parse_test_name":null,"type":"variable"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:56 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Mon, 30-Nov-2020 11:13:55 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - RQNZxTpzmnYtqewiwDnwjOIeDPnPlPWTnfmCTuKeHAaJNSGMGGndPJBReO57sp0w + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "119" + X-Ratelimit-Reset: + - "5" + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "5408708384247461606" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7652819193922499617" + url: https://api.datadoghq.com/api/v1/synthetics/variables/582758e2-bc3b-4eff-aeb9-96a6dd46aef2 + method: GET + response: + body: '{"parse_test_extracted_at":null,"description":"an updated secure global + variable","tags":["foo:bar","baz","env:test"],"parse_test_public_id":null,"value":{"secure":true},"id":"582758e2-bc3b-4eff-aeb9-96a6dd46aef2","parse_test_options":null,"name":"TF_TESTACCDATADOGSYNTHETICSGLOBALVARIABLESECURE_UPDATED_LOCAL_1606130033_UPDATED","created_at":"2020-11-23T11:13:54.399494+00:00","modified_at":"2020-11-23T11:13:56.767001+00:00","created_by":1445416,"parse_test_name":null,"type":"variable"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:56 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Mon, 30-Nov-2020 11:13:56 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - Rk64tCoF3V07+a4szeABxTtZIJ+mXpZWikk4VsgNuvqwu3MpGXqLHxCVHOt9N39v + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "110" + X-Ratelimit-Reset: + - "4" + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "7243583985542919353" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7652819193922499617" + url: https://api.datadoghq.com/api/v1/synthetics/variables/582758e2-bc3b-4eff-aeb9-96a6dd46aef2 + method: GET + response: + body: '{"parse_test_extracted_at":null,"description":"an updated secure global + variable","tags":["foo:bar","baz","env:test"],"parse_test_public_id":null,"value":{"secure":true},"id":"582758e2-bc3b-4eff-aeb9-96a6dd46aef2","parse_test_options":null,"name":"TF_TESTACCDATADOGSYNTHETICSGLOBALVARIABLESECURE_UPDATED_LOCAL_1606130033_UPDATED","created_at":"2020-11-23T11:13:54.399494+00:00","modified_at":"2020-11-23T11:13:56.767001+00:00","created_by":1445416,"parse_test_name":null,"type":"variable"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:57 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Mon, 30-Nov-2020 11:13:57 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - IEUzjgpnyUrp74lH2dqPweGXNQU7es3CY44HHPIdy7aSNeimMebMvcKCoCgyWWVx + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "109" + X-Ratelimit-Reset: + - "3" + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "6463590213843766574" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7652819193922499617" + url: https://api.datadoghq.com/api/v1/synthetics/variables/582758e2-bc3b-4eff-aeb9-96a6dd46aef2 + method: GET + response: + body: '{"parse_test_extracted_at":null,"description":"an updated secure global + variable","tags":["foo:bar","baz","env:test"],"parse_test_public_id":null,"value":{"secure":true},"id":"582758e2-bc3b-4eff-aeb9-96a6dd46aef2","parse_test_options":null,"name":"TF_TESTACCDATADOGSYNTHETICSGLOBALVARIABLESECURE_UPDATED_LOCAL_1606130033_UPDATED","created_at":"2020-11-23T11:13:54.399494+00:00","modified_at":"2020-11-23T11:13:56.767001+00:00","created_by":1445416,"parse_test_name":null,"type":"variable"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:57 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Mon, 30-Nov-2020 11:13:57 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - uJ83xA1OCfjNbetv+4JhF+oFizEHF56t3Lja6jtB8P5etMWBi14GRkWSrGetOvyr + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "108" + X-Ratelimit-Reset: + - "3" + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "6533345055044409761" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7652819193922499617" + url: https://api.datadoghq.com/api/v1/synthetics/variables/582758e2-bc3b-4eff-aeb9-96a6dd46aef2 + method: GET + response: + body: '{"parse_test_extracted_at":null,"description":"an updated secure global + variable","tags":["foo:bar","baz","env:test"],"parse_test_public_id":null,"value":{"secure":true},"id":"582758e2-bc3b-4eff-aeb9-96a6dd46aef2","parse_test_options":null,"name":"TF_TESTACCDATADOGSYNTHETICSGLOBALVARIABLESECURE_UPDATED_LOCAL_1606130033_UPDATED","created_at":"2020-11-23T11:13:54.399494+00:00","modified_at":"2020-11-23T11:13:56.767001+00:00","created_by":1445416,"parse_test_name":null,"type":"variable"}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:57 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Mon, 30-Nov-2020 11:13:57 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - pv0z9DOVfESVNK6d1tOJ7YfC31qHNEzJNjdRZStq3qVP6piD/gWCa9pwKd90Upzy + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "107" + X-Ratelimit-Reset: + - "3" + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - DeleteGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "1741401275577016910" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7652819193922499617" + url: https://api.datadoghq.com/api/v1/synthetics/variables/582758e2-bc3b-4eff-aeb9-96a6dd46aef2 + method: DELETE + response: + body: "null" + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Length: + - "4" + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:57 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Set-Cookie: + - DD-PSHARD=233; Max-Age=604800; Path=/; expires=Mon, 30-Nov-2020 11:13:57 GMT; + secure; HttpOnly + Strict-Transport-Security: + - max-age=15724800; + X-Content-Type-Options: + - nosniff + X-Dd-Debug: + - R1+MRQNzRD0HfjBgLVIjclr4gto/LBUvaJZAn2oF8rsW7iHushLxjdvt+30jZQLP + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "118" + X-Ratelimit-Reset: + - "3" + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Dd-Operation-Id: + - GetGlobalVariable + User-Agent: + - terraform-provider-datadog/dev (terraform 1.15.0; terraform-cli 0.12.7-sdk) + datadog-api-client-go/1.0.0-beta.11 (go go1.15.3; os darwin; arch amd64) + X-Datadog-Parent-Id: + - "5962807078966229877" + X-Datadog-Sampling-Priority: + - "1" + X-Datadog-Trace-Id: + - "7652819193922499617" + url: https://api.datadoghq.com/api/v1/synthetics/variables/582758e2-bc3b-4eff-aeb9-96a6dd46aef2 + method: GET + response: + body: '{"errors": ["Synthetics variable not found"]}' + headers: + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Security-Policy: + - frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report + Content-Type: + - application/json + Date: + - Mon, 23 Nov 2020 11:13:57 GMT + Dd-Pool: + - dogweb + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=15724800; + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Dd-Version: + - "35.3415514" + X-Frame-Options: + - SAMEORIGIN + X-Ratelimit-Limit: + - "120" + X-Ratelimit-Period: + - "60" + X-Ratelimit-Remaining: + - "106" + X-Ratelimit-Reset: + - "3" + status: 404 Not Found + code: 404 + duration: "" diff --git a/datadog/resource_datadog_synthetics_global_variable.go b/datadog/resource_datadog_synthetics_global_variable.go index 99dc7a16cd..ed0e8d43be 100644 --- a/datadog/resource_datadog_synthetics_global_variable.go +++ b/datadog/resource_datadog_synthetics_global_variable.go @@ -33,8 +33,14 @@ func resourceDatadogSyntheticsGlobalVariable() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, }, "value": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Sensitive: true, + }, + "secure": { + Default: false, + Type: schema.TypeBool, + Optional: true, }, }, } @@ -128,7 +134,7 @@ func buildSyntheticsGlobalVariableStruct(d *schema.ResourceData) *datadogV1.Synt syntheticsGlobalVariableValue := datadogV1.SyntheticsGlobalVariableValue{} syntheticsGlobalVariableValue.SetValue(d.Get("value").(string)) - syntheticsGlobalVariableValue.SetSecure(false) + syntheticsGlobalVariableValue.SetSecure(d.Get("secure").(bool)) syntheticsGlobalVariable.SetValue(syntheticsGlobalVariableValue) @@ -140,7 +146,16 @@ func updateSyntheticsGlobalVariableLocalState(d *schema.ResourceData, synthetics d.Set("description", syntheticsGlobalVariable.GetDescription()) syntheticsGlobalVariableValue := syntheticsGlobalVariable.GetValue() - d.Set("value", syntheticsGlobalVariableValue.GetValue()) + + if syntheticsGlobalVariableValue.GetSecure() { + // if the global variable is secure we need to get the value + // from the config since it will not be returned by the api + d.Set("value", d.Get("value").(string)) + } else { + d.Set("value", syntheticsGlobalVariableValue.GetValue()) + } + + d.Set("secure", syntheticsGlobalVariableValue.GetSecure()) d.Set("tags", syntheticsGlobalVariable.Tags) diff --git a/datadog/resource_datadog_synthetics_global_variable_test.go b/datadog/resource_datadog_synthetics_global_variable_test.go index 287cb79803..c6effc1a59 100644 --- a/datadog/resource_datadog_synthetics_global_variable_test.go +++ b/datadog/resource_datadog_synthetics_global_variable_test.go @@ -53,6 +53,21 @@ func TestAccDatadogSyntheticsGlobalVariable_Basic(t *testing.T) { }) } +func TestAccDatadogSyntheticsGlobalVariableSecure_Basic(t *testing.T) { + accProviders, clock, cleanup := testAccProviders(t, initRecorder(t)) + defer cleanup(t) + accProvider := testAccProvider(t, accProviders) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: accProviders, + CheckDestroy: testSyntheticsGlobalVariableIsDestroyed(accProvider), + Steps: []resource.TestStep{ + createSyntheticsGlobalVariableSecureStep(accProvider, clock, t), + }, + }) +} + func TestAccDatadogSyntheticsGlobalVariable_Updated(t *testing.T) { accProviders, clock, cleanup := testAccProviders(t, initRecorder(t)) defer cleanup(t) @@ -69,6 +84,22 @@ func TestAccDatadogSyntheticsGlobalVariable_Updated(t *testing.T) { }) } +func TestAccDatadogSyntheticsGlobalVariableSecure_Updated(t *testing.T) { + accProviders, clock, cleanup := testAccProviders(t, initRecorder(t)) + defer cleanup(t) + accProvider := testAccProvider(t, accProviders) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: accProviders, + CheckDestroy: testSyntheticsGlobalVariableIsDestroyed(accProvider), + Steps: []resource.TestStep{ + createSyntheticsGlobalVariableSecureStep(accProvider, clock, t), + updateSyntheticsGlobalVariableSecureStep(accProvider, clock, t), + }, + }) +} + func createSyntheticsGlobalVariableStep(accProvider *schema.Provider, clock clockwork.FakeClock, t *testing.T) resource.TestStep { variableName := getUniqueVariableName(clock, t) return resource.TestStep{ @@ -135,6 +166,78 @@ resource "datadog_synthetics_global_variable" "foo" { }`, uniq) } +func createSyntheticsGlobalVariableSecureStep(accProvider *schema.Provider, clock clockwork.FakeClock, t *testing.T) resource.TestStep { + variableName := getUniqueVariableName(clock, t) + return resource.TestStep{ + Config: createSyntheticsGlobalVariableSecureConfig(variableName), + Check: resource.ComposeTestCheckFunc( + testSyntheticsGlobalVariableExists(accProvider), + resource.TestCheckResourceAttr( + "datadog_synthetics_global_variable.foo", "name", variableName), + resource.TestCheckResourceAttr( + "datadog_synthetics_global_variable.foo", "description", "a secure global variable"), + resource.TestCheckResourceAttr( + "datadog_synthetics_global_variable.foo", "tags.#", "2"), + resource.TestCheckResourceAttr( + "datadog_synthetics_global_variable.foo", "tags.0", "foo:bar"), + resource.TestCheckResourceAttr( + "datadog_synthetics_global_variable.foo", "tags.1", "baz"), + resource.TestCheckResourceAttr( + "datadog_synthetics_global_variable.foo", "value", "variable-secure-value"), + resource.TestCheckResourceAttr( + "datadog_synthetics_global_variable.foo", "secure", "true"), + ), + } +} + +func createSyntheticsGlobalVariableSecureConfig(uniq string) string { + return fmt.Sprintf(` +resource "datadog_synthetics_global_variable" "foo" { + name = "%s" + description = "a secure global variable" + tags = ["foo:bar", "baz"] + value = "variable-secure-value" + secure = true +}`, uniq) +} + +func updateSyntheticsGlobalVariableSecureStep(accProvider *schema.Provider, clock clockwork.FakeClock, t *testing.T) resource.TestStep { + variableName := getUniqueVariableName(clock, t) + "_UPDATED" + return resource.TestStep{ + Config: updateSyntheticsGlobalVariableSecureConfig(variableName), + Check: resource.ComposeTestCheckFunc( + testSyntheticsGlobalVariableExists(accProvider), + resource.TestCheckResourceAttr( + "datadog_synthetics_global_variable.foo", "name", variableName), + resource.TestCheckResourceAttr( + "datadog_synthetics_global_variable.foo", "description", "an updated secure global variable"), + resource.TestCheckResourceAttr( + "datadog_synthetics_global_variable.foo", "tags.#", "3"), + resource.TestCheckResourceAttr( + "datadog_synthetics_global_variable.foo", "tags.0", "foo:bar"), + resource.TestCheckResourceAttr( + "datadog_synthetics_global_variable.foo", "tags.1", "baz"), + resource.TestCheckResourceAttr( + "datadog_synthetics_global_variable.foo", "tags.2", "env:test"), + resource.TestCheckResourceAttr( + "datadog_synthetics_global_variable.foo", "value", "variable-secure-value-updated"), + resource.TestCheckResourceAttr( + "datadog_synthetics_global_variable.foo", "secure", "true"), + ), + } +} + +func updateSyntheticsGlobalVariableSecureConfig(uniq string) string { + return fmt.Sprintf(` +resource "datadog_synthetics_global_variable" "foo" { + name = "%s" + description = "an updated secure global variable" + tags = ["foo:bar", "baz", "env:test"] + value = "variable-secure-value-updated" + secure = true +}`, uniq) +} + func testSyntheticsGlobalVariableExists(accProvider *schema.Provider) resource.TestCheckFunc { return func(s *terraform.State) error { providerConf := accProvider.Meta().(*ProviderConfiguration) diff --git a/docs/resources/synthetics_global_variable.md b/docs/resources/synthetics_global_variable.md index ebf8211bfc..72fcd3931d 100644 --- a/docs/resources/synthetics_global_variable.md +++ b/docs/resources/synthetics_global_variable.md @@ -9,7 +9,7 @@ Provides a Datadog synthetics global variable resource. This can be used to crea ## Example Usage ```hcl -resource "datadog_synthetics_global_variable" "test_api" { +resource "datadog_synthetics_global_variable" "test_variable" { name = "EXAMPLE_VARIABLE" description = "Description of the variable" tags = ["foo:bar", "env:test"] @@ -17,18 +17,15 @@ resource "datadog_synthetics_global_variable" "test_api" { } ``` -## Secure global variables - -Secure global variables are not supported for now. - ## Argument Reference The following arguments are supported: -- `name`: (Required) Synthetics global variable name -- `description`: (Optional) Description of the global variable +- `name`: (Required) Synthetics global variable name. +- `description`: (Optional) Description of the global variable. - `tags`: (Required) A list of tags to associate with your synthetics global variable. - `value`: (Required) The value of the global variable. +- `secure`: (Optional) Sets the variable as secure, true or false. ## Import