0

Uninstall terraform

by
Published Oct 17, 2025

Delete the resources of the terraform but keep Qovery configuration

Script qovery Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Uninstall terraform
4
 * Delete the resources of the terraform but keep Qovery configuration
5
 */
6
export async function main(
7
	auth: RT.Qovery,
8
	terraformId: string,
9
	body: Body,
10
	force_terraform_action?: 'SKIP_DESTROY' | undefined
11
) {
12
	const url = new URL(`https://api.qovery.com/terraform/${terraformId}/uninstall`)
13
	for (const [k, v] of [['force_terraform_action', force_terraform_action]]) {
14
		if (v !== undefined && v !== '') {
15
			url.searchParams.append(k, v)
16
		}
17
	}
18
	const response = await fetch(url, {
19
		method: 'POST',
20
		headers: {
21
			'Content-Type': 'application/json',
22
			Authorization: 'Token ' + auth.apiKey
23
		},
24
		body: JSON.stringify(body)
25
	})
26
	if (!response.ok) {
27
		const text = await response.text()
28
		throw new Error(`${response.status} ${text}`)
29
	}
30
	return await response.json()
31
}
32

33
/* eslint-disable */
34
/**
35
 * This file was automatically generated by json-schema-to-typescript.
36
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
37
 * and run json-schema-to-typescript to regenerate this file.
38
 */
39

40
export interface Body {
41
	[k: string]: unknown
42
}
43