Skip to main content

Widgets

WidgetRenderType(s)
simple_text
Simple field dedicated to text
string
number
Simple field dedicated to numbers
integer, float
text_area 
Multi-line text field
any
dropdown 
Menus display a list of options
any but raw
auto_complete
Provides suggestions while you type into the field
string
radios 
Graphical control element that allows the user to choose only one of a exclusive options
any but raw
switch 
Choosing between 2 positions on/off
boolean
date_time
Date and time picker with optional format and weekday-only selection
string
cy_cred
Expose cycloid credentials available
string
cy_inventory_resource
Select a resource attribute from the inventory and link the value to this asset
string, integer, array
cy_inventory_output
Select a output attribute from the inventory and link the value to this asset
any but raw
slider_range 
Select option by dragging a slider along a range
integer
slider_list 
Select option by dragging a slider along list of options
string, boolean, integer
cy_scs
Expose cycloid catalog repositories available
string
cy_crs
Expose cycloid config repositories available
string
cy_branch
Expose branches available from cy_scs or cy_crs
string
hiddenNothing displayed Widget used to store and pass values that are not visible to the end userany

Define pipeline variables

Terraform variables

Define the widget variable in your .forms.yml file

.forms.yml
use_cases:
- name: myusecase
sections:
- name: mysection
groups:
- name: mygroup
# Here we use the terraform technology
technologies: [terraform]
vars:
- name: "Terraform variable"
description: "Example of terraform variable."
key: my_terraform_variable
widget: simple_text
type: string
default: "mydefaultvalue"

Define your variable in your terraform module

terraform/your-module/variables.tf
variable "my_terraform_variable" {
type = string
}

Don't forget to create your main.tf.sample

main.tf.sample
module "example" {
#####################################
# Do not modify the following lines #
source = "./module-example"

project = var.project
env = var.env
organization = var.organization
#####################################

other_module_variable = ""

# The terraform variable will be injected by StackForms as a module argument here
# like that :
my_terraform_variable = "mydefaultvalue"
}

Now, my_terraform_variable variable can be used in your terraform code.

Ansible variables

Details

StackForms will inject ansible variables using the --ansible-extra-var command line argument. So they will always win according to ansible variable precedence.

Example

Define the widget variable in your .forms.yml file

.forms.yml
use_cases:
- name: myusecase
sections:
- name: mysection
groups:
- name: mygroup
# Don't forget to use the ansible technology
technologies: [ansible]
vars:
- name: "Ansible variable"
description: "Example of ansible variable."
key: my_ansible_variable
widget: simple_text
type: string
default: "mydefaultvalue"

Keep in mind your variable name is defined by the key field (my_ansible_variable)

Use your variable in ansible

ansible/playbook.yml
- name: Hello world
ansible.builtin.debug:
msg: My stackform var is {{ my_ansible_variable }}

In this example, the variable is used to display a custom message in an ansible task.