Capture data from HTTP responses and reuse it later.

HTTP variables let you capture request data from an HTTP response. The chaptured data can be accessed in subsequent test steps.


resource "http_variable" "my_variable" {
  source = "json_body"
  property = "data[0].key"
  variable = "some_key"

resource "http_step" "step" {
    url = "http://localhost/?key=${var.some_key}",


  • source — location of the response value that we want to capture.
  • variable — variable name for referencing the captured value later.
  • property — property name of the source (json_body and header sources only).
  • numeric_type (optional) — treatment of numeric values (json_body only, default int).


  • header — response header.
  • json_body — JSON response body.

Numeric type

Variables are always captured as strings from the response body. When using json_body source with a property pointing to a JSON number field, we can use numeric_type to choose how we want to parse the number.

Allowed options are:
  • int — numeric value will be parsed as an integer, e.g 1.0 will be captured as a string 1.
  • float — numeric value will be parsed as a floating point number, e.g. 1.0 will be captured as a string 1.0.


Property is an additional piece of information that some value sources require to located the data.

header source uses property to find HTTP header for comparison:

source = "header"
target = "Content-Type"

json_body source uses property to find attribute within JSON object:

source = "json_body"
target = "data.key[0]"


  • id - resource ID.