Terraform for HTTP
Use this integration to collect evidence from HTTP endpoints
Written By Micah
With our Terraform for HTTP integration, you can collect evidence from any HTTP endpoint accessible from your network. Terraform integrations are a flexible, low-code solution that allows you to customize what evidence is collected from web services. Read more about our Terraform integrations.
Types of evidence you might collect with Terraform for HTTP
The HTTP provider gives you flexibility to collect evidence from any web service that exposes data through public or basic auth HTTP endpoints.
Important note: You do not need to use Terraform in your tech stack in order to use this integration to collect evidence.
Here is a short, non-exhaustive list of some of the possible evidence you may collect from this integration:
HTML content of a public Privacy Policy webpage
Health check status of a public server IP
Follow the instructions on this page to get started collecting evidence from HTTP endpoints using Terraform.
Configuring Terraform for HTTP
To configure the Terraform integration with the HTTP provider, you will need:
The URLs of the endpoints you want to collect evidence from
Any required authentication credentials (if the endpoints require authentication); please note that this method only supports basic auth.
Get started by navigating to the Integration Manager in Strike Graph and opening the Terraform for HTTP integration. Note: if you do not see this integration listed, it may not be available for your organization or role yet; reach out to support or your Customer Success Manager to request access.
Click on the "+ Connect" button to begin configuring a new integration.
Using Terraform for HTTP to collect evidence
Once you have enabled the Terraform for HTTP integration, you can begin using it to collect evidence from HTTP endpoints.
Start by navigating in Strike Graph to the item that you want to collect evidence for. You can choose to attach evidence directly for one-time evidence collection, or configure automated collection (recommended).
Select the Terraform for HTTP connection from the list of available integration sources for evidence collection.
Define the data to collect
Terraform integrations allow you to use a few lines of code to define what data you would like to collect as evidence. These are called "data blocks" and more information about data blocks and local values can be found on the Terraform overview page.
With Terraform for HTTP, you can collect evidence from HTTP endpoints by defining the URL and any required request parameters.
Step 1: Define the data block. Data blocks for HTTP follow this pattern:
"http" "temp_name" { url = "https://example.com/api/endpoint" method = "GET" # Optional, defaults to "GET" # Optional request headers # Optional request body for POST, PUT, etc. request_body = ({ key = "value" }) }data_source: For HTTP, this will always be "http"temp_name: This is a temporary name you define and is used to refer to this data block during execution. It only has labeling significance within the scope of this configuration. The temp name is used in the output's filename, so it's recommended that you name it with something recognizable. Names can be repeated across configurations, are limited to alphanumeric characters, and do not allow spaces.url: The full URL of the HTTP endpoint you want to collect data frommethod: Optional. The HTTP method to use (GET, POST, PUT, DELETE). Defaults to GET if not specified.request_headers: Optional. A map of request headers to send with the request, such as authorization tokens or content type specifications.request_body: Optional. The body of the request for methods like POST or PUT.
Step 2: Define the local values used for the execution. This follows a typical pattern that is derived from the data block: data.http.temp_name.response_body
For HTTP, you can access:
response_body: The body of the responsestatus_code: The HTTP status code of the responseresponse_headers: The headers of the response
Run the data collection
After you have defined the data block and local values, click the "Attach" button to execute the data collection. This may take a few minutes as we set up the data pipeline to collect the attachment.
Once the collection is finished, the attachment modal will close and you can see the collected data has been added to the evidence. You can confirm what was collected by clicking on the attachment to view the data.
Using Terraform for HTTP with Automated Collection
It is highly recommended that you configure your evidence collection with automated collection. With Automated Collection, Strike Graph can recollect evidence attachments from HTTP endpoints a few days before expiration so that your evidence remains in an effective 'audit ready' state.
To configure your evidence with Automated Collection, follow the steps above after clicking on the "Automated Collection" button found on the evidence item detail pages. Additional information about Automated Collection is available here.
Removing your Terraform for HTTP integration
You can remove the integration at any time. Please note that removing an integration does not delete any files that were attached using that integration, but removing an integration will disrupt automated collection.
To remove:
Go to the Integrations Manager and click on the Terraform for HTTP card to access the integration configurations.
Click the "Deactivate" button next to your configuration.
Note: You may have access to remove integrations for other users on your team.
Troubleshooting
For additional Terraform troubleshooting tips, click here.
Terraform integrations will return an error if we were unable to execute the collection request. The errors returned will be different depending on which step of the collection failed.
HTTP-specific errors
When using the HTTP provider, you might encounter these common issues:
Connection errors: Check that the URL is accessible from Strike Graph's network and that any required network configurations are in place.
Authentication errors: If you receive 401 or 403 status codes, verify that your authentication credentials are correct and that the token hasn't expired.
Rate limiting: Some APIs implement rate limiting. If you receive 429 status codes, you may need to reduce the frequency of your automated collection.
Malformed responses: If the API returns data in an unexpected format, it might cause parsing errors. Check the format of the response and adjust your local values accordingly.
General formatting errors
If the error message returned during evidence collection is pretty generic (like "Something went wrong") it may be a formatting issue. Check that your temp_name is formatted correctly (no spaces, only alphanumeric characters) and that there are not any other unexpected characters or formatting issues in the data block or local values.
Confirm the local values
Confirm that the local values are formatted correctly. For HTTP, the local value should follow the pattern data.http.temp_name.response_body (or .status_code or .response_headers). Check that the temp_name value is the same between the data block and local values.