Infrastructure as CodeStandard Library

Standard Actions

Actions available in the standard library

These actions are available in all Runbooks as part of the standard library.

send_http_request

The std::send_http_request action makes an HTTP request to the specified URL.

Inputs

NameRequiredTypeDescription
urlrequiredstringThe URL to send the request to
methodoptionalstringThe HTTP method (GET, POST, PUT, DELETE). Default: GET
headersoptionalmapHTTP headers to include in the request
bodyoptionalstringThe request body (for POST/PUT requests)
timeout_msoptionalintegerRequest timeout in milliseconds

Outputs

NameTypeDescription
status_codeintegerThe HTTP status code
bodystringThe response body
headersmapThe response headers
action "api_call" "std::send_http_request" {
    description = "Fetch data from API"
    url = "https://api.example.com/data"
    method = "GET"
    headers = {
        "Authorization" = "Bearer ${variable.token}"
    }
}

output "response" {
    value = action.api_call.body
}

output "status" {
    value = action.api_call.status_code
}

POST Request Example

action "create_resource" "std::send_http_request" {
    description = "Create a new resource"
    url = "https://api.example.com/resources"
    method = "POST"
    headers = {
        "Content-Type" = "application/json"
    }
    body = {
        "name" = variable.name,
        "value" = variable.value
    }
}

On this page