Moves state from another OpenTofu node in the same team to a node in this template. The state will be removed from the source node as such running the source node again may recreate resources.
Required permission
Account > Templates > General > Update
Path parameters
templateId
string requiredID of the template
Request body
- {object}
copyResourceDefinitions
booleanWhether to return the source node resource definitions so they can be applied to the target template.overwriteTargetState
booleanWhether to replace state that already exists on the target OpenTofu node.sourceTemplateId
string requiredID of the template containing the source OpenTofu node.pattern^[A-Za-z0-9-]+$sourceStateKey
string requiredState key of the source OpenTofu node.targetStateKey
string requiredState key of the target OpenTofu node.
Response body
- {object}Response object.
data
{object} requiredResult data.resourceDefinitions
{object}Resource definitions copied from the source OpenTofu node.
API
CLI
JS Client
POST /v1/templates/{templateId}/opentofu/import-state
POST /v1/teams/{teamId}/templates/{templateId}/opentofu/import-state
Example request
Request body
curl --header "Content-Type: application/json" \
--header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
--request POST \
--data '{"sourceTemplateId":"source-template","sourceStateKey":"source-state","targetStateKey":"target-state"}' \
https://api.northflank.com/v1/templates/{templateId}/opentofu/import-stateExample response
200 OK
The imported OpenTofu resource definitions.
JSON