Skip to content
中文

Delete a target's OpenTofu state

Code Mode: praxis.devops.projects.environments.targets.deleteState

HTTP: DELETE /devops/v1/projects/{project}/environments/{environment}/targets/{target}/state

Delete the current OpenTofu state of one deploy target, as OpenTofu does when a workspace is deleted. The kept versions of earlier writes stay. While a lock is held the call must carry its ID, otherwise it answers 409 LOCK_CONFLICT. Deleting a state that does not exist succeeds.

Signature

praxis.devops.projects.environments.targets.deleteState(args:{path:{/** e.g. "dvp_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ project:string;/** e.g. "dve_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ environment:string;/** e.g. "services%2Fontology" */ target:string};query?:{/** e.g. "4c1f0a52-8f4e-9d6c-1b0e-5a7d3c2e9f10" */ ID?:string}}):Promise<unknown>;

Parameters

NameInTypeRequiredDescription
projectpathstringyesIdentifies the project whose data you are reading, from the project list or create answer.
environmentpathstringyesIdentifies the DevOps environment (dve_…) whose deploy state you address, from the project’s environment list.
targetpathstringyesThe deploy target’s repository path, URL-encoded as one segment: services/ontology is written services%2Fontology.
IDquerystringnoThe ID of the lock this call holds, exactly as OpenTofu received it from the lock call. Required while a lock is held; a missing or different ID answers 409 LOCK_CONFLICT.

Responses

StatusContent typesDescription
200The current state is gone; the kept versions remain.
401application/jsonThe API key is missing or invalid; send a valid Praxis API key in the Authorization header before retrying.
404application/jsonNOT_FOUND means the project or environment does not exist for this organization, or, on a read, that the target has no state yet. Nothing is revealed about another organization’s projects. OpenTofu reads a missing state as empty.
409application/jsonLOCK_CONFLICT means the state is locked by another holder or the ID names a lock that is not held; STALE_SERIAL means the write is older than the stored state of the same lineage. Nothing changed; re-run the deploy so OpenTofu takes the lock and reads the current state.
500application/jsonINTERNAL means the service could not complete the request; retry once, and if it repeats report the request id. A read is safe to repeat; a write that failed this way should be re-read before it is sent again.