2017-02-15 19:47:30 +01:00
|
|
|
---
|
2017-02-15 21:19:38 +01:00
|
|
|
layout: "backend-types"
|
|
|
|
page_title: "Backend Type: http"
|
|
|
|
sidebar_current: "docs-backends-types-standard-http"
|
2017-02-15 19:47:30 +01:00
|
|
|
description: |-
|
2017-02-15 21:19:38 +01:00
|
|
|
Terraform can store state remotely at any valid HTTP endpoint.
|
2017-02-15 19:47:30 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
# http
|
|
|
|
|
2017-08-13 18:49:49 +02:00
|
|
|
**Kind: Standard (with optional locking)**
|
2017-02-15 21:19:38 +01:00
|
|
|
|
2017-02-15 19:47:30 +01:00
|
|
|
Stores the state using a simple [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) client.
|
|
|
|
|
|
|
|
State will be fetched via GET, updated via POST, and purged with DELETE.
|
|
|
|
|
2017-08-13 18:49:49 +02:00
|
|
|
If locking is enabled a lock POST request will be made by appending `/lock` to the configured address with the lock info in the
|
|
|
|
body as json. The endpiont should return a 409 Conflict with the holding lock info when it's already taken, 200 OK for success.
|
|
|
|
Any other status will be considered an error. Unlocking works simillarly, appending `/unlock` and adding the `ID` of the lock
|
|
|
|
being freed as a query parameter. An `ID` query parameter will also be added when sending state updates.
|
|
|
|
|
2017-02-15 19:47:30 +01:00
|
|
|
## Example Usage
|
|
|
|
|
2017-04-05 17:29:27 +02:00
|
|
|
```hcl
|
2017-02-15 21:19:38 +01:00
|
|
|
terraform {
|
|
|
|
backend "http" {
|
|
|
|
address = "http://myrest.api.com"
|
|
|
|
}
|
|
|
|
}
|
2017-02-15 19:47:30 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
## Example Referencing
|
|
|
|
|
2017-04-05 17:29:27 +02:00
|
|
|
```hcl
|
2017-02-15 19:47:30 +01:00
|
|
|
data "terraform_remote_state" "foo" {
|
2017-04-05 17:29:27 +02:00
|
|
|
backend = "http"
|
|
|
|
config {
|
|
|
|
address = "http://my.rest.api.com"
|
|
|
|
}
|
2017-02-15 19:47:30 +01:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Configuration variables
|
|
|
|
|
|
|
|
The following configuration options are supported:
|
|
|
|
|
|
|
|
* `address` - (Required) The address of the REST endpoint
|
|
|
|
* `username` - (Optional) The username for HTTP basic authentication
|
|
|
|
* `password` - (Optional) The password for HTTP basic authentication
|
|
|
|
* `skip_cert_verification` - (Optional) Whether to skip TLS verification.
|
|
|
|
Defaults to `false`.
|
2017-08-13 18:49:49 +02:00
|
|
|
* `supports_locking` - (Optional) Whether to enable locking related calls
|
|
|
|
Defaults to `false`.
|