Skip to content

Commit 4a15d8d

Browse files
authored
feat: Add azure devops var group module (#400)
* Add azure devops var group module * Add variables description
1 parent 5223d18 commit 4a15d8d

File tree

7 files changed

+66
-0
lines changed

7 files changed

+66
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.terraform
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export AZDO_PERSONAL_ACCESS_TOKEN=
2+
export AZDO_ORG_SERVICE_URL=
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
data "azuredevops_project" "project" {
2+
project_name = var.project_name
3+
}
4+
5+
resource "azuredevops_variable_group" "variablegroup" {
6+
project_id = data.azuredevops_project.project.id
7+
name = var.variable_group_name
8+
description = var.variable_group_description
9+
allow_access = var.allow_access
10+
11+
dynamic "variable" {
12+
for_each = var.variables
13+
content {
14+
name = variable.value.name
15+
value = variable.value.value
16+
is_secret = variable.value.is_secret
17+
}
18+
}
19+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
output "id" {
2+
value = azuredevops_project.project.id
3+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
project_name = ""
2+
variable_group_name = "test terraform"
3+
variables = [{
4+
name = "anyname"
5+
value = "any value"
6+
is_secret = false
7+
}]
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
variable "project_name" {
2+
type = string
3+
description = "Azure DevOps project name that will be used to add the new variable group"
4+
}
5+
6+
variable "variable_group_name" {
7+
type = string
8+
description = "Azure DevOps Variable Group Name to be created"
9+
}
10+
11+
12+
variable "variable_group_description" {
13+
type = string
14+
description = ""
15+
default = "An optional field to add description about the variable group"
16+
}
17+
18+
variable "allow_access" {
19+
type = bool
20+
description = "A flag to detirmine if the variable group will allow to access all pipelines or not"
21+
default = true
22+
}
23+
24+
variable "variables" {
25+
type = list(object({
26+
name = string
27+
value = string
28+
is_secret = bool
29+
}))
30+
}
31+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
provider "azuredevops" {
2+
version = ">= 0.0.1"
3+
}

0 commit comments

Comments
 (0)