Skip to content

Latest commit

 

History

History
85 lines (60 loc) · 2.71 KB

variable_group.html.markdown

File metadata and controls

85 lines (60 loc) · 2.71 KB
layout page_title description
azuredevops
AzureDevops: azuredevops_variable_group
Manages variable groups within Azure DevOps project.

azuredevops_variable_group

Manages variable groups within Azure DevOps.

Example Usage

resource "azuredevops_project" "project" {
  name = "Test Project"
}

resource "azuredevops_variable_group" "variablegroup" {
  project_id   = azuredevops_project.project.id
  name         = "Test Variable Group"
  description  = "Test Variable Group Description"
  allow_access = true

  variable {
    name  = "key"
    value = "value"
  }

  variable {
    name         = "Account Password"
    secret_value = "p@ssword123"
    is_secret    = true
  }
}

Argument Reference

The following arguments are supported:

  • project_id - (Required) The project ID or project name.
  • name - (Required) The name of the Variable Group.
  • description - (Optional) The description of the Variable Group.
  • allow_access - (Required) Boolean that indicate if this variable group is shared by all pipelines of this project.
  • variable - (Optional) One or more variable blocks as documented below.

A variable block supports the following:

  • name - (Required) The key value used for the variable. Must be unique within the Variable Group.
  • value - (Optional) The value of the variable. If omitted, it will default to empty string.
  • secret_value - (Optional) The secret value of the variable. If omitted, it will default to empty string. Used when is_secret set to true.
  • is_secret - (Optional) A boolean flag describing if the variable value is sensitive. Defaults to false.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - The ID of the Variable Group returned after creation in Azure DevOps.

Relevant Links

Import

Variable groups containing secret values cannot be imported.

Azure DevOps Variable groups can be imported using the project name/variable group ID or by the project Guid/variable group ID, e.g.

$ terraform import azuredevops_variable_group.variablegroup "Test Project/10"

or

$ terraform import azuredevops_variable_group.variablegroup 00000000-0000-0000-0000-000000000000/0

Note that for secret variables, the import command retrieve blank value in the tfstate.

PAT Permissions Required

  • Variable Groups: Read, Create, & Manage