v1
Northflank docs for LLMs
API
CLI
JS Client

Team / Templates /

Import OpenTofu state

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 required
      ID of the template

Request body

  • {object}
    • copyResourceDefinitions

      boolean
      Whether to return the source node resource definitions so they can be applied to the target template.
    • overwriteTargetState

      boolean
      Whether to replace state that already exists on the target OpenTofu node.
    • sourceTemplateId

      string required
      ID of the template containing the source OpenTofu node.
      pattern
      ^[A-Za-z0-9-]+$
    • sourceStateKey

      string required
      State key of the source OpenTofu node.
    • targetStateKey

      string required
      State key of the target OpenTofu node.

Response body

  • {object}
    Response object.
    • data

      {object} required
      Result 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-state

    Example response

    200 OK

    The imported OpenTofu resource definitions.

    JSON

    © 2026 Northflank Ltd. All rights reserved.

    northflank.com / Terms / Privacy / feedback@northflank.com