Skip to content

Commit

Permalink
feat(automations): datasource support (#310)
Browse files Browse the repository at this point in the history
* feat(automations): datasource support

* Generate Terraform Docs

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
parkedwards and github-actions[bot] authored Nov 26, 2024
1 parent ad5bd5b commit 7bc03b2
Show file tree
Hide file tree
Showing 7 changed files with 1,371 additions and 5 deletions.
263 changes: 263 additions & 0 deletions docs/data-sources/automation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "prefect_automation Data Source - prefect"
subcategory: ""
description: |-
Get information about an existing Automation by its ID
---

# prefect_automation (Data Source)

Get information about an existing Automation by its ID

## Example Usage

```terraform
data "prefect_automation" "test" {
id = "7759cb06-ea19-48fc-b277-61db8bdb3de9"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `id` (String) Automation ID (UUID)

### Optional

- `account_id` (String) Account ID (UUID), defaults to the account set in the provider
- `workspace_id` (String) Workspace ID (UUID), defaults to the workspace set in the provider

### Read-Only

- `actions` (Attributes List) List of actions to perform when the automation is triggered (see [below for nested schema](#nestedatt--actions))
- `actions_on_resolve` (Attributes List) List of actions to perform when the automation is triggered (see [below for nested schema](#nestedatt--actions_on_resolve))
- `actions_on_trigger` (Attributes List) List of actions to perform when the automation is triggered (see [below for nested schema](#nestedatt--actions_on_trigger))
- `created` (String) Timestamp of when the resource was created (RFC3339)
- `description` (String) Description of the automation
- `enabled` (Boolean) Whether the automation is enabled
- `name` (String) Name of the automation
- `trigger` (Attributes) The criteria for which events this Automation covers and how it will respond (see [below for nested schema](#nestedatt--trigger))
- `updated` (String) Timestamp of when the resource was updated (RFC3339)

<a id="nestedatt--actions"></a>
### Nested Schema for `actions`

Read-Only:

- `automation_id` (String) (Automation) ID of the automation to apply this action to
- `block_document_id` (String) (Webhook / Notification) ID of the block to use
- `body` (String) (Notification) Body of the notification
- `deployment_id` (String) (Deployment) ID of the deployment to apply this action to
- `job_variables` (String) (Deployment) (JSON) Job variables to pass to the created flow run. Use `jsonencode()`.
- `message` (String) (Flow Run State Change) Message to associate with the state change
- `name` (String) (Flow Run State Change) Name of the state to change the flow run to
- `parameters` (String) (Deployment) (JSON) Parameters to pass to the deployment. Use `jsonencode()`.
- `payload` (String) (Webhook) Payload to send when calling the webhook
- `source` (String) (Deployment / Work Pool / Work Queue / Automation) Whether this action applies to a specific selected resource or to a specific resource by ID - 'selected' or 'inferred'
- `state` (String) (Flow Run State Change) Type of state to change the flow run to
- `subject` (String) (Notification) Subject of the notification
- `type` (String) The type of action to perform
- `work_pool_id` (String) (Work Pool) ID of the work pool to apply this action to
- `work_queue_id` (String) (Work Queue) ID of the work queue to apply this action to


<a id="nestedatt--actions_on_resolve"></a>
### Nested Schema for `actions_on_resolve`

Read-Only:

- `automation_id` (String) (Automation) ID of the automation to apply this action to
- `block_document_id` (String) (Webhook / Notification) ID of the block to use
- `body` (String) (Notification) Body of the notification
- `deployment_id` (String) (Deployment) ID of the deployment to apply this action to
- `job_variables` (String) (Deployment) (JSON) Job variables to pass to the created flow run. Use `jsonencode()`.
- `message` (String) (Flow Run State Change) Message to associate with the state change
- `name` (String) (Flow Run State Change) Name of the state to change the flow run to
- `parameters` (String) (Deployment) (JSON) Parameters to pass to the deployment. Use `jsonencode()`.
- `payload` (String) (Webhook) Payload to send when calling the webhook
- `source` (String) (Deployment / Work Pool / Work Queue / Automation) Whether this action applies to a specific selected resource or to a specific resource by ID - 'selected' or 'inferred'
- `state` (String) (Flow Run State Change) Type of state to change the flow run to
- `subject` (String) (Notification) Subject of the notification
- `type` (String) The type of action to perform
- `work_pool_id` (String) (Work Pool) ID of the work pool to apply this action to
- `work_queue_id` (String) (Work Queue) ID of the work queue to apply this action to


<a id="nestedatt--actions_on_trigger"></a>
### Nested Schema for `actions_on_trigger`

Read-Only:

- `automation_id` (String) (Automation) ID of the automation to apply this action to
- `block_document_id` (String) (Webhook / Notification) ID of the block to use
- `body` (String) (Notification) Body of the notification
- `deployment_id` (String) (Deployment) ID of the deployment to apply this action to
- `job_variables` (String) (Deployment) (JSON) Job variables to pass to the created flow run. Use `jsonencode()`.
- `message` (String) (Flow Run State Change) Message to associate with the state change
- `name` (String) (Flow Run State Change) Name of the state to change the flow run to
- `parameters` (String) (Deployment) (JSON) Parameters to pass to the deployment. Use `jsonencode()`.
- `payload` (String) (Webhook) Payload to send when calling the webhook
- `source` (String) (Deployment / Work Pool / Work Queue / Automation) Whether this action applies to a specific selected resource or to a specific resource by ID - 'selected' or 'inferred'
- `state` (String) (Flow Run State Change) Type of state to change the flow run to
- `subject` (String) (Notification) Subject of the notification
- `type` (String) The type of action to perform
- `work_pool_id` (String) (Work Pool) ID of the work pool to apply this action to
- `work_queue_id` (String) (Work Queue) ID of the work queue to apply this action to


<a id="nestedatt--trigger"></a>
### Nested Schema for `trigger`

Read-Only:

- `compound` (Attributes) A composite trigger that requires some number of triggers to have fired within the given time period (see [below for nested schema](#nestedatt--trigger--compound))
- `event` (Attributes) A trigger that fires based on the presence or absence of events within a given period of time (see [below for nested schema](#nestedatt--trigger--event))
- `metric` (Attributes) A trigger that fires based on the results of a metric query (see [below for nested schema](#nestedatt--trigger--metric))
- `sequence` (Attributes) A composite trigger that requires triggers to fire in a specific order (see [below for nested schema](#nestedatt--trigger--sequence))

<a id="nestedatt--trigger--compound"></a>
### Nested Schema for `trigger.compound`

Read-Only:

- `require` (Dynamic) How many triggers must fire ('any', 'all', or a number)
- `triggers` (Attributes List) The ordered list of triggers that must fire in sequence (see [below for nested schema](#nestedatt--trigger--compound--triggers))
- `within` (Number) The time period in seconds over which the events must occur

<a id="nestedatt--trigger--compound--triggers"></a>
### Nested Schema for `trigger.compound.triggers`

Read-Only:

- `event` (Attributes) A trigger that fires based on the presence or absence of events within a given period of time (see [below for nested schema](#nestedatt--trigger--compound--triggers--event))
- `metric` (Attributes) A trigger that fires based on the results of a metric query (see [below for nested schema](#nestedatt--trigger--compound--triggers--metric))

<a id="nestedatt--trigger--compound--triggers--event"></a>
### Nested Schema for `trigger.compound.triggers.event`

Read-Only:

- `after` (List of String) The event(s) which must first been seen to fire this trigger. If empty, then fire this trigger immediately
- `expect` (List of String) The event(s) this trigger is expecting to see. If empty, this trigger will match any event
- `for_each` (List of String) Evaluate the trigger separately for each distinct value of these labels on the resource
- `match` (String) (JSON) Resource specification labels which this trigger will match. Use `jsonencode()`.
- `match_related` (String) (JSON) Resource specification labels for related resources which this trigger will match. Use `jsonencode()`.
- `posture` (String) The posture of this trigger, either Reactive or Proactive
- `threshold` (Number) The number of events required for this trigger to fire (Reactive) or expected (Proactive)
- `within` (Number) The time period in seconds over which the events must occur


<a id="nestedatt--trigger--compound--triggers--metric"></a>
### Nested Schema for `trigger.compound.triggers.metric`

Read-Only:

- `match` (String) (JSON) Resource specification labels which this trigger will match. Use `jsonencode()`.
- `match_related` (String) (JSON) Resource specification labels for related resources which this trigger will match. Use `jsonencode()`.
- `metric` (Attributes) (see [below for nested schema](#nestedatt--trigger--compound--triggers--metric--metric))

<a id="nestedatt--trigger--compound--triggers--metric--metric"></a>
### Nested Schema for `trigger.compound.triggers.metric.metric`

Read-Only:

- `firing_for` (Number) The duration (seconds) for which the metric query must breach OR resolve continuously before the state is updated and actions are triggered.
- `name` (String) The name of the metric to query
- `operator` (String) The comparative operator used to evaluate the query result against the threshold value
- `range` (Number) The lookback duration (seconds) for a metric query. This duration is used to determine the time range over which the query will be executed.
- `threshold` (Number) The threshold value against which we'll compare the query results





<a id="nestedatt--trigger--event"></a>
### Nested Schema for `trigger.event`

Read-Only:

- `after` (List of String) The event(s) which must first been seen to fire this trigger. If empty, then fire this trigger immediately
- `expect` (List of String) The event(s) this trigger is expecting to see. If empty, this trigger will match any event
- `for_each` (List of String) Evaluate the trigger separately for each distinct value of these labels on the resource
- `match` (String) (JSON) Resource specification labels which this trigger will match. Use `jsonencode()`.
- `match_related` (String) (JSON) Resource specification labels for related resources which this trigger will match. Use `jsonencode()`.
- `posture` (String) The posture of this trigger, either Reactive or Proactive
- `threshold` (Number) The number of events required for this trigger to fire (Reactive) or expected (Proactive)
- `within` (Number) The time period in seconds over which the events must occur


<a id="nestedatt--trigger--metric"></a>
### Nested Schema for `trigger.metric`

Read-Only:

- `match` (String) (JSON) Resource specification labels which this trigger will match. Use `jsonencode()`.
- `match_related` (String) (JSON) Resource specification labels for related resources which this trigger will match. Use `jsonencode()`.
- `metric` (Attributes) (see [below for nested schema](#nestedatt--trigger--metric--metric))

<a id="nestedatt--trigger--metric--metric"></a>
### Nested Schema for `trigger.metric.metric`

Read-Only:

- `firing_for` (Number) The duration (seconds) for which the metric query must breach OR resolve continuously before the state is updated and actions are triggered.
- `name` (String) The name of the metric to query
- `operator` (String) The comparative operator used to evaluate the query result against the threshold value
- `range` (Number) The lookback duration (seconds) for a metric query. This duration is used to determine the time range over which the query will be executed.
- `threshold` (Number) The threshold value against which we'll compare the query results



<a id="nestedatt--trigger--sequence"></a>
### Nested Schema for `trigger.sequence`

Read-Only:

- `triggers` (Attributes List) The ordered list of triggers that must fire in sequence (see [below for nested schema](#nestedatt--trigger--sequence--triggers))
- `within` (Number) The time period in seconds over which the events must occur

<a id="nestedatt--trigger--sequence--triggers"></a>
### Nested Schema for `trigger.sequence.triggers`

Read-Only:

- `event` (Attributes) A trigger that fires based on the presence or absence of events within a given period of time (see [below for nested schema](#nestedatt--trigger--sequence--triggers--event))
- `metric` (Attributes) A trigger that fires based on the results of a metric query (see [below for nested schema](#nestedatt--trigger--sequence--triggers--metric))

<a id="nestedatt--trigger--sequence--triggers--event"></a>
### Nested Schema for `trigger.sequence.triggers.event`

Read-Only:

- `after` (List of String) The event(s) which must first been seen to fire this trigger. If empty, then fire this trigger immediately
- `expect` (List of String) The event(s) this trigger is expecting to see. If empty, this trigger will match any event
- `for_each` (List of String) Evaluate the trigger separately for each distinct value of these labels on the resource
- `match` (String) (JSON) Resource specification labels which this trigger will match. Use `jsonencode()`.
- `match_related` (String) (JSON) Resource specification labels for related resources which this trigger will match. Use `jsonencode()`.
- `posture` (String) The posture of this trigger, either Reactive or Proactive
- `threshold` (Number) The number of events required for this trigger to fire (Reactive) or expected (Proactive)
- `within` (Number) The time period in seconds over which the events must occur


<a id="nestedatt--trigger--sequence--triggers--metric"></a>
### Nested Schema for `trigger.sequence.triggers.metric`

Read-Only:

- `match` (String) (JSON) Resource specification labels which this trigger will match. Use `jsonencode()`.
- `match_related` (String) (JSON) Resource specification labels for related resources which this trigger will match. Use `jsonencode()`.
- `metric` (Attributes) (see [below for nested schema](#nestedatt--trigger--sequence--triggers--metric--metric))

<a id="nestedatt--trigger--sequence--triggers--metric--metric"></a>
### Nested Schema for `trigger.sequence.triggers.metric.metric`

Read-Only:

- `firing_for` (Number) The duration (seconds) for which the metric query must breach OR resolve continuously before the state is updated and actions are triggered.
- `name` (String) The name of the metric to query
- `operator` (String) The comparative operator used to evaluate the query result against the threshold value
- `range` (Number) The lookback duration (seconds) for a metric query. This duration is used to determine the time range over which the query will be executed.
- `threshold` (Number) The threshold value against which we'll compare the query results
3 changes: 3 additions & 0 deletions examples/data-sources/prefect_automation/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data "prefect_automation" "test" {
id = "7759cb06-ea19-48fc-b277-61db8bdb3de9"
}
Loading

0 comments on commit 7bc03b2

Please sign in to comment.