Widgets
Widget | Render |
---|---|
simple_text | Simple field dedicated to text |
number | Simple field dedicated to numbers |
text_area | Multi-line text field |
dropdown | Menus display a list of options |
auto_complete | Provides suggestions while you type into the field |
radios | Graphical control element that allows the user to choose only one of a exclusive options |
switch | Choosing between 2 positions on/off |
cy_cred | ![]() Expose cycloid credentials available |
cy_inventory_resource | Select a resource attribute from the inventory and link the value to this asset |
slider_range | Select option by dragging a slider along a range |
slider_list | Select option by dragging a slider along list of options |
cy_scs | ![]() Expose cycloid catalog repositories available |
cy_crs | Expose cycloid config repositories available |
cy_branch | ![]() Expose branches available from cy_scs or cy_crs |
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.