Coder powers secure, scalable development across key industries — automotive, finance, government, and technology — enabling faster builds, tighter compliance, and seamless AI adoption in enterprise-grade cloud environments.
Identity-aware parameters change based on the roles and groups of the user filling in the workspace creation form.
Use them to set governance policy directly in the form, rather than creating multiple templates to manage RBAC.
User identity is referenced in Terraform by reading the coder_workspace_owner data source.
Coder fills in this data source with the current user's identity each time the form renders, unlike other data sources, which Coder reads once at template import.
Refer to How Coder evaluates parameters for more information.
To change parameters based on the user's other selections instead, refer to Conditional parameters.
Examples
The following examples show common ways to use identity-aware parameters.
Adapt the group names, roles, and options to match your deployment.
Role-aware options
Template administrators often want to expose certain experimental or unstable options only to those with elevated roles.
You can do this by setting count based on a user's group or role, referencing the coder_workspace_owner data source.
locals {
roles = [for r in data.coder_workspace_owner.me.rbac_roles: r.name]
is_admin = contains(data.coder_workspace_owner.me.groups, "admin")
has_admin_role = contains(local.roles, "owner")
}
data "coder_workspace_owner" "me" {}
data "coder_parameter" "advanced_settings" {
# This parameter is only visible when the user is an administrator
count = local.is_admin ? 1 : 0
name = "advanced_settings"
display_name = "Add an arbitrary script"
description = "An advanced configuration option only available to admins."
type = "string"
form_type = "textarea"
mutable = true
order = 5
styling = jsonencode({
placeholder = <<-EOT
#!/usr/bin/env bash
while true; do
echo "hello world"
sleep 1
done
EOT
})
}
Group-aware regions
You can expose regions depending on which group a user belongs to.
This way, developers can't accidentally pick a distant region and get high latency.
If your Coder groups map to Kubernetes namespaces, fill a parameter's options from the user's groups.
Users can then deploy only to the namespaces of groups they belong to.