The gitlab_project_variable
resource allows to manage the lifecycle of a CI/CD variable for a project.
Upstream API: GitLab REST API docs
resource "gitlab_project_variable" "example" {
project = "12345"
key = "project_variable_key"
value = "project_variable_value"
protected = false
}
key
(String) The name of the variable.project
(String) The name or id of the project.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 project variables can be imported using an id made up of `project:key:environment_scope`, e.g.
terraform import gitlab_project_variable.example '12345:project_variable_key:*'