Skip to main content
This example automates the creation of a GitHub repository, infrastructure provisioning with Terraform, and generates a PR for setting up an RDS instance.

Step 1: Register the Scaffolder templates

This Workflow uses two Scaffolder templates: Follow the instructions to register the Scaffolder templates in Cortex.

Step 2: Start creating the Workflow

Follow the steps in the documentation to create a Workflow and configure its basic settings.

Step 3: Add blocks to the Workflow

The instructions on this page describe how to create this Workflow in the Cortex UI, but it is also possible to copy the Workflow YAML and add it to your workspace via the Cortex CLI. This allows you to quickly set up the example configuration then iterate on it for your own use case. Expand the tile below to learn more.
To upload the Workflow example YAML into your workspace:
  1. Save the Workflow example YAML file below:
  1. Use the Cortex CLI to run this command, using the path to your Workflow YAML file:
    cortex workflows create -f <path-to-your-workflow.yaml>
Expand the tiles below to learn about each block in this Workflow and how to configure them in the Cortex UI:
Create a data transformation to take the Workflow initiator’s name and append -repo to it:
  1. Click + in the center of the page. In the block library modal, choose Data transformation.
  2. In the block configuration side panel, enter a name and unique slug for this block.
    1. In this example, we use the name Transform user info and the slug transform-user-info.
  3. Add a jq expression to take the initiator’s name and add -repo to it:
  1. At the bottom of the side panel, click Save.
This block creates a new repository in your connected Git integration, using templating to apply the output of the previous block to the Scaffolder configuration.
  1. Click + in the center of the page. In the block library modal, select the Scaffolder block.
  2. In the side panel, enter a name and unique slug for the block.
    1. In this example, we use the name Scaffold Hello Org Repo and the slug scaffold-hello-org.
  3. Under Scaffolder template, select your template. In this example, we use Hello Org Template.
  4. Select the option to Create a new repo.
  5. Add override variables. The Variable dropdown pulls in all the variables that are able to be overridden in the Git provider and in the Scaffolder template. In this example, we apply the following override:
    • repo_name: actions.transform-user-info.outputs.result
      • This overrides the Repo Name field with the output of the “Transform user info” block earlier in the Workflow.
  6. At the bottom of the side panel, click Save.
This block triggers Terraform infrastructure in GitHub.
  1. Click + in the center of the page. In the block library modal, select the GitHub > Trigger workflow block.
  2. In the side panel, enter a name and unique slug for the block.
    • In this example, we use the name Terraform Infrastructure Provisioning and the slug trigger-workflow.
  3. Configure the block:
    • Repository: Enter your repository name.
    • Ref: Enter the Git reference to trigger the workflow on, e.g. main.
    • Workflow ID or file name: Enter the ID of the GitHub workflow or the file name of the workflow file.
      • In our example, we added main.yaml. Note that this should be just the file name and not the path to the file.
    • Inputs: Optionally enter key-value pairs to pass to the workflow.
      • In our example, we added: {"user": "{{context.initiatedBy.name}}"}
  4. At the bottom of the side panel, click Save.
This block opens a Pull Request to set up an RDS instance, using templating to apply the output of the previous block to the Scaffolder configuration.
  1. Click + in the center of the page. In the block library modal, select the Scaffolder block.
  2. In the side panel, enter a name and unique slug for the block.
    1. In this example, we use the name Open PR with RDS terraform and the slug scaffold-rds-terraform.
  3. Under Scaffolder template, select your template. In this example, we use Terraform RDS Template.
  4. Select the option to Open a pull request.
  5. Add override variables. The Variable dropdown pulls in all the variables that are able to be overridden in the Git provider and in the Scaffolder template. In this example, we apply the following override:
    • publisherRepoFullName: actions.scaffold-hello-org.outputs.response.gitURL
      • This overrides the Repo Name field with the output of the “Scaffold Hello Org Repo” block earlier in the Workflow.
  6. At the bottom of the side panel, click Save.
In this step, we send a templated message via Slack informing the user that their test environment is ready.
  1. Click + in the center of the page. In the block library modal, select the Slack block.
  2. In the side panel, enter a name and unique slug for the block.
    • In this example we use the name Notify developer and the slug notify-developer.
  3. Select a Slack channel name.
  4. Enter text for the message that will be sent via Slack. In our example, we use the following:
  1. Save the block.

Step 4: Run the Workflow

When you run the Workflow, the following events happen:
  • The Data transformation block runs, which produces a repository name for the user based on your specified naming convention.
  • The Scaffolder runs, creating a new repository. The repo’s name is based on the output of the previous block.
  • The GitHub “Trigger a workflow” block runs, which provisions Terraform infrastructure.
  • The second Scaffolder block runs, which opens a Pull Request to set up an RDS instance.
  • The Slack block runs, which sends a Slack message to the user to let them know that their test environment is ready.
Last modified on September 28, 2026