HTTP Data Source
Official
HCP Packer Ready
Type: http
The http
data source makes an HTTP GET request to the given URL and exports information about the response.
Basic Example
data "http" "example" {
url = "https://checkpoint-api.hashicorp.com/v1/check/terraform"
# Optional request headers
request_headers = {
Accept = "application/json"
}
}
Configuration Reference
Configuration options are organized below into two categories: required and optional. Within each category, the available options are alphabetized and described.
Required:
url
(string) - The URL to request data from. This URL must respond with a200 OK
response and atext/*
orapplication/json
Content-Type.
Not Required:
request_headers
(map[string]string) - A map of strings representing additional HTTP headers to include in the request.
Datasource outputs
The outputs for this datasource are as follows:
url
(string) - The URL the data was requested from.body
(string) - The raw body of the HTTP response.request_headers
(map[string]string) - A map of strings representing the response HTTP headers. Duplicate headers are concatenated with, according to RFC2616.