Skip to content
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
39 changes: 39 additions & 0 deletions docs/resources/workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "ctrlplane_workflow Resource - ctrlplane"
subcategory: ""
description: |-
Manages a workflow in Ctrlplane.
---

# ctrlplane_workflow (Resource)

Manages a workflow in Ctrlplane.



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

### Required

- `name` (String) The name of the workflow.

### Optional

- `inputs` (String) JSON-encoded array of workflow input definitions.
- `job_agent` (Block List) Job agents to dispatch when the workflow runs. (see [below for nested schema](#nestedblock--job_agent))

### Read-Only

- `id` (String) The ID of the workflow.

<a id="nestedblock--job_agent"></a>
### Nested Schema for `job_agent`

Required:

- `config` (Map of String) Configuration for the job agent.
- `name` (String) Name of the job agent entry.
- `ref` (String) ID of the job agent to reference.
- `selector` (String) CEL expression to determine if the job agent should dispatch. Use "true" to always dispatch.
14 changes: 14 additions & 0 deletions examples/resources/workflow/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
terraform {
required_providers {
ctrlplane = {
source = "ctrlplanedev/ctrlplane"
version = "~> 1"
}
}
}

provider "ctrlplane" {
workspace = var.workspace
url = var.url
api_key = var.api_key
}
15 changes: 15 additions & 0 deletions examples/resources/workflow/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
variable "workspace" {
type = string
description = "The workspace to use"
}

variable "url" {
type = string
description = "The URL of the Ctrlplane API"
}

variable "api_key" {
type = string
description = "The API key for the Ctrlplane API"
sensitive = true
}
43 changes: 43 additions & 0 deletions examples/resources/workflow/workflows.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
resource "ctrlplane_job_agent" "runner_1" {
name = "workflow-runner-1"

test_runner {
delay_seconds = 10
status = "successful"
message = "Test runner job agent"
}
}

resource "ctrlplane_job_agent" "runner_2" {
name = "workflow-runner-2"

test_runner {
delay_seconds = 10
status = "successful"
message = "Test runner job agent"
}
}

resource "ctrlplane_workflow" "example" {
name = "example-workflow"

inputs = jsonencode([
{ key = "environment", type = "string", default = "staging" },
{ key = "retries", type = "number", default = 3 },
{ key = "dryRun", type = "boolean", default = true },
])

job_agent {
name = "workflow-runner-1"
ref = ctrlplane_job_agent.runner_1.id
config = { delaySeconds = "10", message = "Test runner job agent", status = "successful" }
selector = "true"
}

job_agent {
name = "workflow-runner-2"
ref = ctrlplane_job_agent.runner_2.id
config = { delaySeconds = "10", message = "Test runner job agent", status = "successful" }
selector = "true"
}
}
Loading