The gitlab_group_variable
resource allows to manage the lifecycle of a CI/CD variable for a group.
Upstream API: GitLab REST API docs
resource "gitlab_group_variable" "example" {
group = "12345"
key = "group_variable_key"
value = "group_variable_value"
protected = false
masked = false
environment_scope = "*"
}
group
(String) The name or id of the group.key
(String) The name of the variable.value
(String) The value of the variable.description
(String) The description of the variable.environment_scope
(String) The environment scope of the variable. Defaults to all environment (*
). Note that in Community Editions of Gitlab, values other than *
will cause inconsistent plans.masked
(Boolean) If set to true
, the value of the variable will be hidden in job logs. The value must meet the masking requirements. Defaults to false
.protected
(Boolean) If set to true
, the variable will be passed only to pipelines running on protected branches and tags. Defaults to false
.raw
(Boolean) Whether the variable is treated as a raw string. Default: false. When true, variables in the value are not expanded.variable_type
(String) The type of a variable. Valid values are: env_var
, file
. Default is env_var
.id
(String) The ID of this resource.Import is supported using the following syntax:
# GitLab group variables can be imported using an id made up of `groupid:variablename:scope`, e.g.
terraform import gitlab_group_variable.example 12345:group_variable_key:*