Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docs): add links to CLI, API, Terraform, and Helm docs #17142

Merged
merged 18 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions docs/contribute/docs-contribute.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,25 @@ Your docs should now be available at `http://localhost:3000`.
See the [Mintlify documentation](https://mintlify.com/docs/development) for more information on how to install Mintlify, build previews, and use Mintlify's features while writing docs.

<Info>All documentation is written in `.mdx` files, which are Markdown files that can contain JavaScript and React components. </Info>

## Considerations

Keep in mind the following when writing documentation.

### External references

Prefect resources can be managed in several ways, including through the CLI, UI, Terraform, Helm, and API.

When documenting a resource, consider including external references that describe how to manage the resource in other ways.
Snippets are available to provide these references in a consistent format.

For example, the [Deployment documentation](/v3/deploy) includes a snippet for the Terraform provider:

```javascript
import { TF } from "/snippets/resource-management/terraform.mdx"
import { deployments } from "/snippets/resource-management/vars.mdx"

<TF name="deployments" href={deployments.tf} />
```

For more information on how to use snippets, see the [Mintlify documentation](https://mintlify.com/docs/reusable-snippets).
9 changes: 9 additions & 0 deletions docs/integrations/prefect-aws/ecs_guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ If you specify a task definition [ARN (Amazon Resource Name)](https://docs.aws.a

You can use either EC2 or Fargate as the capacity provider. Fargate simplifies initiation, but lengthens infrastructure setup time for each flow run. Using EC2 for the ECS cluster can reduce setup time. In this example, we will show how to use Fargate.

import { TF } from "/snippets/resource-management/terraform.mdx"
import { HELM } from "/snippets/resource-management/helm.mdx"
import { workers } from "/snippets/resource-management/vars.mdx"
import { work_pools } from "/snippets/resource-management/vars.mdx"

<HELM name="Prefect workers" href={workers.helm} />

<TF name="work pools" href={work_pools.tf} />

{/*
TODO update link to Example repo when this issue is completed: https://github.com/PrefectHQ/examples/issues/11
<Tip>
Expand Down
3 changes: 2 additions & 1 deletion docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@
],
"version": "v3"
},
"v3/manage/self-host"
"v3/manage/self-host",
"v3/manage/infrastructure-as-code"
],
"version": "v3"
},
Expand Down
3 changes: 3 additions & 0 deletions docs/snippets/resource-management/api.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const API = ({ name, href }) => (
<p>You can manage {name} with the <a href={href}>Prefect API</a>.</p>
);
3 changes: 3 additions & 0 deletions docs/snippets/resource-management/cli.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const CLI = ({ name, href }) => (
<p>You can manage {name} with the <a href={href}>Prefect CLI</a>.</p>
);
3 changes: 3 additions & 0 deletions docs/snippets/resource-management/combined.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const COMBINED = ({ name, hrefTF, hrefAPI, hrefCLI }) => (
<p>You can manage {name} with the <a href={hrefCLI}>Prefect CLI</a>, <a href={hrefTF}>Terraform provider</a>, or <a href={hrefAPI}>Prefect API</a>.</p>
);
3 changes: 3 additions & 0 deletions docs/snippets/resource-management/helm.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const HELM = ({ name, href }) => (
<p>You can manage {name} with the <a href={href}>Prefect Helm charts</a>.</p>
);
3 changes: 3 additions & 0 deletions docs/snippets/resource-management/terraform.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const TF = ({ name, href }) => (
<p>You can manage {name} with the <a href={href}>Terraform provider for Prefect</a>.</p>
);
63 changes: 63 additions & 0 deletions docs/snippets/resource-management/vars.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
export const home = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, we define the links in one place and reuse them when we import the snippets. There may be a way to DRY this file up as well, but I haven't found something that works yet with mdx + URLs.

tf: "https://registry.terraform.io/providers/PrefectHQ/prefect/latest/docs/guides/getting-started",
cli: "https://docs.prefect.io/v3/api-ref/cli/index",
api: "https://app.prefect.cloud/api/docs",
helm: "https://github.com/PrefectHQ/prefect-helm/tree/main/charts",
}

export const deployments = {
cli: "https://docs.prefect.io/v3/api-ref/cli/deployment",
api: "https://app.prefect.cloud/api/docs#tag/Deployments",
tf: "https://registry.terraform.io/providers/PrefectHQ/prefect/latest/docs/resources/deployment",
}

export const work_pools = {
cli: "https://docs.prefect.io/v3/api-ref/cli/work-pool",
api: "https://app.prefect.cloud/api/docs#tag/Work-Pools",
tf: "https://registry.terraform.io/providers/PrefectHQ/prefect/latest/docs/resources/work_pool",
}

export const variables = {
cli: "https://docs.prefect.io/v3/api-ref/cli/variable",
api: "https://app.prefect.cloud/api/docs#tag/Variables",
tf: "https://registry.terraform.io/providers/PrefectHQ/prefect/latest/docs/resources/variable",
}

export const automations = {
cli: "https://docs.prefect.io/v3/api-ref/cli/automation",
api: "https://app.prefect.cloud/api/docs#tag/Automations",
tf: "https://registry.terraform.io/providers/PrefectHQ/prefect/latest/docs/resources/automation",
}

export const events = {
cli: "https://docs.prefect.io/v3/api-ref/cli/event",
api: "https://app.prefect.cloud/api/docs#tag/Events",
tf: "https://registry.terraform.io/providers/PrefectHQ/prefect/latest/docs/resources/automation",
}

export const webhooks = {
api: "https://app.prefect.cloud/api/docs#tag/Webhooks",
tf: "https://registry.terraform.io/providers/PrefectHQ/prefect/latest/docs/resources/webhook",
}

export const blocks = {
cli: "https://docs.prefect.io/v3/api-ref/cli/block",
api: "https://app.prefect.cloud/api/docs#tag/Blocks",
tf: "https://registry.terraform.io/providers/PrefectHQ/prefect/latest/docs/resources/block",
}

export const global_concurrency = {
cli: "https://docs.prefect.io/v3/api-ref/cli/global-concurrency-limit",
api: "https://app.prefect.cloud/api/docs#tag/Concurrency-Limits-V2",
tf: "https://registry.terraform.io/providers/PrefectHQ/prefect/latest/docs/resources/global_concurrency_limit",
}

export const task_run_concurrency = {
cli: "https://docs.prefect.io/v3/api-ref/cli/concurrency-limit",
api: "https://app.prefect.cloud/api/docs#tag/Concurrency-Limits",
tf: "https://registry.terraform.io/providers/PrefectHQ/prefect/latest/docs/resources/task_run_concurrency_limit",
}

export const workers = {
helm: "https://github.com/PrefectHQ/prefect-helm/tree/main/charts/prefect-server",
}
9 changes: 8 additions & 1 deletion docs/v3/automate/add-schedules.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ my_flow.serve(

</CodeGroup>

### Create schedules in the terminal
### Create schedules with the CLI

You can create a schedule through the interactive `prefect deploy` command. You will be prompted to choose which type of schedule to create.

Expand All @@ -126,6 +126,13 @@ deployments:
active: true
```

### Create schedules with Terraform

import { TF } from "/snippets/resource-management/terraform.mdx"
import { deployments } from "/snippets/resource-management/vars.mdx"

<TF name="schedules" href={deployments.tf} />

## Schedule types

Prefect supports three types of schedules:
Expand Down
12 changes: 5 additions & 7 deletions docs/v3/automate/events/automations-triggers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ On the **Automations** page, select the **+** icon to create a new automation. Y
- One or more [actions](#actions) carried out by the automation.
- [Details](#details) about the automation, such as a name and description.

import { COMBINED } from "/snippets/resource-management/combined.mdx"
import { automations } from "/snippets/resource-management/vars.mdx"

<COMBINED name="automations" hrefTF={automations.tf} hrefAPI={automations.api} hrefCLI={automations.cli} />

## Manage automations

The **Automations** page provides an overview of all configured automations for your workspace.
Expand All @@ -43,13 +48,6 @@ common conditions, such as:
- Metric thresholds, such as average duration, lateness, or completion percentage
- Custom event triggers

<Note>
**Automations API**

The [automations API](https://app.prefect.cloud/api/docs#tag/Automations) enables further programmatic customization of
trigger and action policies based on arbitrary [events](https://app.prefect.cloud/api/docs#tag/Events).
</Note>

Importantly, you can configure the triggers not only in reaction to events, but also proactively: in the absence of
an expected event.

Expand Down
7 changes: 7 additions & 0 deletions docs/v3/automate/events/custom-triggers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ Each automation has a single trigger that, when fired, causes all of its associa
trigger may be a reactive or proactive event trigger, a trigger monitoring the value of a metric, or a composite trigger
that combines several underlying triggers.

import { TF } from "/snippets/resource-management/terraform.mdx"
import { API } from "/snippets/resource-management/api.mdx"
import { events } from "/snippets/resource-management/vars.mdx"

<TF name="events" href={events.tf} />
<API name="events" href={events.api} />

### Event triggers

Event triggers are the most common type of trigger. They are intended to react to the presence or absence of an event.
Expand Down
5 changes: 5 additions & 0 deletions docs/v3/automate/events/events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ In Prefect Cloud, events power [audit logs](/v3/manage/cloud/manage-users/audit-
Events enable observability into your data stack through the [event feed in the UI](#events-in-the-cloud-ui) and the
configuration of Prefect's reactivity through [automations](/v3/automate/events/automations-triggers/).

import { COMBINED } from "/snippets/resource-management/combined.mdx"
import { events } from "/snippets/resource-management/vars.mdx"

<COMBINED name="events" hrefTF={events.tf} hrefAPI={events.api} hrefCLI={events.cli} />

## Event specification

Events adhere to a structured [specification](https://app.prefect.cloud/api/docs#tag/Events).
Expand Down
15 changes: 12 additions & 3 deletions docs/v3/automate/events/webhook-triggers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ Set up your webhooks through the Prefect Cloud API, Prefect Cloud UI, or Prefect

### Through the Prefect Cloud API

Webhooks are managed through the [Webhooks API
endpoints](https://app.prefect.cloud/api/docs#tag/Webhooks). This is a Prefect
Cloud-only feature. Authenticate API calls using the standard
import { API } from "/snippets/resource-management/api.mdx"
import { webhooks } from "/snippets/resource-management/vars.mdx"

<API name="webhooks" href={webhooks.api} />

This is a Prefect Cloud-only feature. Authenticate API calls using the standard
[authentication methods](/v3/manage/cloud/connect-to-cloud#manually-configure-prefect-api-settings) you use with Prefect
Cloud.

Expand Down Expand Up @@ -74,6 +77,12 @@ Use `rotate` to generate a new, random endpoint if you're concerned your webhook
prefect cloud webhook rotate <webhook-url-slug>
```

### Through Terraform

import { TF } from "/snippets/resource-management/terraform.mdx"

<TF name="webhooks" href={webhooks.tf} />

## Webhook endpoints

The webhook endpoints have randomly generated opaque URLs that do not divulge any information about your Prefect Cloud workspace.
Expand Down
13 changes: 13 additions & 0 deletions docs/v3/deploy/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,19 @@ Learn more about creating deployments with a YAML file in [Define deployments wi

Prefect also provides [CI/CD options](/v3/deploy/infrastructure-concepts/deploy-ci-cd) for automatically creating YAML-based deployments.

### Create a deployment with Terraform

import { TF } from "/snippets/resource-management/terraform.mdx"
import { deployments } from "/snippets/resource-management/vars.mdx"

<TF name="deployments" href={deployments.tf} />

### Create a deployment with the API

import { API } from "/snippets/resource-management/api.mdx"

<API name="deployments" href={deployments.api} />

### Work pools

[Work pools](/v3/deploy/infrastructure-concepts/work-pools/) allow you to switch between different types of infrastructure and to create a template for deployments.
Expand Down
7 changes: 7 additions & 0 deletions docs/v3/deploy/infrastructure-concepts/customize.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ prefect deployment run \
--job-variable HELLO=THERE
```

### Use job variables in Terraform

import { TF } from "/snippets/resource-management/terraform.mdx"
import { deployments } from "/snippets/resource-management/vars.mdx"

<TF name="job variables" href={deployments.tf} />

### Use job variables in automations

Additionally, runs kicked off through automation actions can use job variables, including ones rendered from Jinja
Expand Down
5 changes: 4 additions & 1 deletion docs/v3/deploy/infrastructure-concepts/deploy-ci-cd.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -424,4 +424,7 @@ registry URL to the `registry` key in the `with:` part of the action and use an

## See also

If you're using Terraform to manage your infrastructure, check out the [Prefect Cloud Terraform provider](https://registry.terraform.io/providers/PrefectHQ/prefect/latest/docs/guides/getting-started).
import { TF } from "/snippets/resource-management/terraform.mdx"
import { home } from "/snippets/resource-management/vars.mdx"

<TF name="resources" href={home.tf} />
33 changes: 18 additions & 15 deletions docs/v3/deploy/infrastructure-concepts/work-pools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,20 @@ flowchart LR

### Work pool configuration

You can configure work pools by using any of the following:

- Prefect UI
- Prefect CLI commands
- [Prefect REST API](/v3/api-ref/rest-api/)
- [Terraform provider for Prefect Cloud](https://registry.terraform.io/providers/PrefectHQ/prefect/latest/docs/resources/work_pool)
You can configure work pools by using the Prefect UI.

To manage work pools in the UI, click the **Work Pools** icon. This displays a list of currently configured work pools.

![The UI displays a list of configured work pools](/v3/img/ui/work-pool-list.png)

Select the **+** button to create a new work pool. You can specify the details about infrastructure created for this work pool.

To create a work pool through the Prefect CLI, use the `prefect work-pool create` command:
#### Using the CLI

import { CLI } from "/snippets/resource-management/cli.mdx"
import { work_pools } from "/snippets/resource-management/vars.mdx"

<CLI name="work pools" href={work_pools.cli} />

```bash
prefect work-pool create [OPTIONS] NAME
Expand All @@ -115,14 +115,6 @@ Optional configuration parameters to filter work on the pool include:
| `--set-as-default` | Whether to use the created work pool as the local default for deployment. |
| <span class="no-wrap">`--base-job-template`</span> | The path to a JSON file containing the base job template to use. If unspecified, Prefect uses the default base job template for the given worker type. |

To update a work pool through the Prefect CLI, use the `prefect work-pool update` command:

```bash
prefect work-pool update [OPTIONS] NAME
```

`NAME` is the name of the work pool to update.

Optional configuration parameters you can specify to update the work pool include:

| Option | Description |
Expand All @@ -144,6 +136,17 @@ Optional configuration parameters you can specify to update the work pool includ
```
</Tip>

#### Using Terraform

import { TF } from "/snippets/resource-management/terraform.mdx"

<TF name="work pools" href={work_pools.tf} />

#### Using the REST API

import { API } from "/snippets/resource-management/api.mdx"

<API name="work pools" href={work_pools.api} />

### Work pool types

Expand Down
4 changes: 4 additions & 0 deletions docs/v3/deploy/infrastructure-concepts/workers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -197,5 +197,9 @@ See how to [daemonize a Prefect worker](/v3/deploy/daemonize-processes/).

See more information on [overriding a work pool's job variables](/v3/deploy/infrastructure-concepts/customize).

import { HELM } from "/snippets/resource-management/helm.mdx"
import { workers } from "/snippets/resource-management/vars.mdx"

<HELM name="workers" href={workers.helm} />

---------
9 changes: 9 additions & 0 deletions docs/v3/develop/blocks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -472,3 +472,12 @@ If a block type is not available in the UI, you can [register it](#register-bloc
| SQLAlchemy Connector | `sqlalchemy-connector` | [prefect-sqlalchemy](/integrations/prefect-sqlalchemy/) |

Anyone can create a custom block type and, optionally, share it with the community.

## Additional resources

import { CLI } from "/snippets/resource-management/cli.mdx"
import { TF } from "/snippets/resource-management/terraform.mdx"
import { blocks } from "/snippets/resource-management/vars.mdx"

<CLI name="blocks" href={blocks.cli} />
<TF name="blocks" href={blocks.tf} />
Loading