-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathdefault_headers_example.tf
More file actions
38 lines (33 loc) · 922 Bytes
/
Copy pathdefault_headers_example.tf
File metadata and controls
38 lines (33 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Provider default_headers can be configured in the provider block:
#
# provider "terracurl" {
# default_headers = {
# Authorization = "Bearer ${var.api_token}"
# }
# }
#
# Use default_headers for short-lived auth tokens that must be refreshed on
# every Terraform run, including destroy. Provider headers override resource
# headers with the same key.
provider "terracurl" {
default_headers = {
Authorization = "Bearer example-token"
}
}
resource "terracurl_request" "example" {
name = "example"
url = "https://httpbin.org/put"
method = "PUT"
headers = {
Content-Type = "application/json"
}
request_body = jsonencode({ id = "example" })
response_codes = [200]
skip_read = true
destroy_url = "https://httpbin.org/delete"
destroy_method = "DELETE"
destroy_response_codes = [200]
destroy_headers = {
Content-Type = "application/json"
}
}