Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Commit bfadfef

Browse files
committed
First draft of CLI import docs
1 parent c6fab96 commit bfadfef

3 files changed

Lines changed: 75 additions & 1 deletion

File tree

site/content/docs/cli/cli-vs-terraform-pulumi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: CLI vs. Terraform & Pulumi - Checkly Docs
33
displayTitle: CLI vs. Terraform & Pulumi
4-
weight: 9
4+
weight: 10
55
menu:
66
platform:
77
parent: "CLI"

site/content/docs/cli/command-line-reference.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,3 +240,41 @@ Copy Playwright config into the Checkly config file.
240240
```bash
241241
npx checkly sync-playwright
242242
```
243+
244+
## `npx checkly import`
245+
246+
Import resources not yet managed by the CLI from your account. See [Importing an existing account](/docs/cli/import/) for details.
247+
248+
### `npx checkly import plan`
249+
250+
Generate code for all resources to be imported:
251+
```bash
252+
npx checkly import plan [--root] [--config]
253+
```
254+
255+
- `--root`: Specify the directory where the generated code should be placed. Default is the `checkMatch` directory in your `checkly.config.ts/js`
256+
- `--config` or `-c`: Location of your `checkly.config.ts/js` file. Default is current directory.
257+
258+
### `npx checkly import apply`
259+
Applies a plan generated by `npx checkly import plan`:
260+
```bash
261+
npx checkly import apply [--config]
262+
```
263+
264+
- `--config` or `-c`: Location of your `checkly.config.ts/js` file. Default is current directory.
265+
266+
### `npx checkly import commit`
267+
Commits a plan applied by `npx checkly import apply`:
268+
```bash
269+
npx checkly import commit [--config]
270+
```
271+
272+
- `--config` or `-c`: Location of your `checkly.config.ts/js` file. Default is current directory.
273+
274+
### `npx checkly import cancel`
275+
Cancels a generated plan that has not been commited yet:
276+
```bash
277+
npx checkly import cancel [--config]
278+
```
279+
280+
- `--config` or `-c`: Location of your `checkly.config.ts/js` file. Default is current directory.

site/content/docs/cli/import.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: Importing your account - Checkly Docs
3+
displayTitle: Importing your account to the Checkly CLI
4+
navTitle: Importing an existing account
5+
weight: 9
6+
slug: /import
7+
menu:
8+
platform:
9+
parent: "CLI"
10+
identifier: import-cli
11+
---
12+
13+
If you got started with Checkly working in the webapp you can use the `import` CLI command to download all your UI-managed resources as code and start managing your entire Checkly setup from the CLI.
14+
15+
## How `import` works
16+
17+
When importing an existing resource the CLI will both generate the code neccessary to manage the resource through code, and mark the resource itself as managed by the CLI, and not the UI. This allows you to start editing, and also deleting the resource through the CLI.
18+
19+
To ensure that you can go through this process safely, and test your setup along the way the import process is done in three separate steps: Plan, apply and commit.
20+
- `npx checkly import plan`: This generates the code for all resources in your account not already managed through the CLI, allowing for a review of all resources that will be imported. At this point no mapping have been created between imported resources and the existing ones in your account. A `deploy` in this state will create duplicate resources. If you cancel here, nothing will have changed for existing resources on your account.
21+
- `npx checkly import apply`: Links the imported resources to your CLI project, but keeps the mapping in a **pending** state. You can now make changes to resources in your account via the CLI, as the mapping has been established. As long as this mapping is **pending** you cannot delete any of the imported resources via the CLI. You are free to test your setup and deploy changes, but you will be prevented from deleting any resources until you commit your plan. You can cancel your import at this stage, but any changes made to resources through a `deploy` will persist.
22+
- `npx checkly import commit`: Commits the plan, removing the **pending** state from all imported resources. Imported resources can now be deleted through the CLI by removing their constructs. At this point the `import` is completed and cannot be canceled.
23+
24+
## Importing step-by-step
25+
26+
1. [Install the CLI](/docs/cli/installation/). At the end of the process ensure you have a `checkly.config.ts/js` file, and that you have logged in to the account you want to import resources from. You can verify the current account with `npx checkly whoami`.
27+
2. Run `npx checkly import plan`. This will generate the code for all resources in your account not already managed by the CLI. You can specify where the generated code should be placed using `--root`. If your Checkly config file is not in the current directory, specify the path using `--config`.
28+
3. Review the imported code before continuing. You can verify imported checks with `npx checkly test`. At this point, avoid running `npx checkly deploy` as this will generate duplicate resources.
29+
4. Run `npx checkly import apply` to create the link between the imported resources and your CLI project. You can try out editing resources and pushing these updates to your account with `npx checkly deploy`.
30+
5. When you are satisfied with your setup, run `npx checkly import commit` to finalize the import.
31+
32+
Remember that you can cancel your import with `npx checkly import cancel` at any point before running `npx checkly import commit`, but changes made to existing resources after the apply-stage will persist after cancelling.
33+
34+
## Next steps
35+
36+
Once you have a fully CLI managed setup you are ready to leverage Monitoring as Code to improve your setup. Check our how to [dynamically creating monitors](/docs/cli/dynamic-check-creation/), [combining MaC and Git](/docs/cli/using-git/), and how to [integrate Checkly in your CI/CD process](/docs/cicd/).

0 commit comments

Comments
 (0)