-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.tf
98 lines (83 loc) · 4.06 KB
/
variables.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
variable "keyvault_id" {
type = string
description = "Azure Key Vault resource object_id."
}
variable "namespace" {
type = string
default = "keyvault"
description = "Namespace to use for akv2k8s chart."
}
variable "keyvault_service_principal_create" {
type = bool
default = true
description = "Create a new application service principal for akv2k8s chart. (default: true)"
}
variable "keyvault_service_principal_app_name" {
type = string
default = "akv2k8s"
description = "Name of the newly created application service principal for akv2k8s chart. (default: akv2k8s)"
}
variable "keyvault_service_principal_from_keyvault" {
type = bool
default = false
description = "Import service principal credentials for akv2k8s from Azure Key Vault. (default: false)"
}
resource "errorcheck_is_valid" "keyvault_service_principal_selector_validation" {
name = "Keyvault Service Principal Selector Validation"
test = {
assert = !var.keyvault_service_principal_create || !var.keyvault_service_principal_from_keyvault
error_message = "keyvault_service_principal_create and keyvault_service_principal_from_keyvault can not be enabled at the same time!"
}
}
variable "keyvault_service_principal_app_id_secret_name" {
type = string
default = ""
description = "Azure Key Vault secret name for service principal ID."
}
variable "keyvault_service_principal_password_secret_name" {
type = string
default = ""
description = "Azure Key Vault secret name for service principal password."
}
resource "errorcheck_is_valid" "keyvault_service_principal_app_id_secret_name_validation" {
name = "Keyvault Service Principal App ID Secret Validation"
test = {
assert = length(var.keyvault_service_principal_app_id_secret_name) != 0 || !var.keyvault_service_principal_from_keyvault
error_message = "The variable keyvault_service_principal_app_id_secret_name can not be empty if keyvault_service_principal_from_keyvault is enabled!"
}
depends_on = [errorcheck_is_valid.keyvault_service_principal_selector_validation]
}
resource "errorcheck_is_valid" "keyvault_service_principal_password_secret_name_validation" {
name = "Keyvault Service Principal Password Secret Validation"
test = {
assert = length(var.keyvault_service_principal_password_secret_name) != 0 || !var.keyvault_service_principal_from_keyvault
error_message = "The variable keyvault_service_principal_password_secret_name can not be empty if keyvault_service_principal_from_keyvault is enabled!"
}
depends_on = [errorcheck_is_valid.keyvault_service_principal_selector_validation]
}
variable "keyvault_service_principal_app_id" {
type = string
default = ""
description = "Service principal app ID."
}
variable "keyvault_service_principal_password" {
type = string
default = ""
description = "Service principal password."
}
resource "errorcheck_is_valid" "keyvault_service_principal_app_id_validation" {
name = "Keyvault Service Principal App ID Validation"
test = {
assert = length(var.keyvault_service_principal_app_id) != 0 || var.keyvault_service_principal_create || var.keyvault_service_principal_from_keyvault
error_message = "The variable keyvault_service_principal_app_id can not be empty if both keyvault_service_principal_create and keyvault_service_principal_from_keyvault is disabled!"
}
depends_on = [errorcheck_is_valid.keyvault_service_principal_selector_validation]
}
resource "errorcheck_is_valid" "keyvault_service_principal_password_validation" {
name = "Keyvault Service Principal Password Validation"
test = {
assert = length(var.keyvault_service_principal_password) != 0 || var.keyvault_service_principal_create || var.keyvault_service_principal_from_keyvault
error_message = "The variable keyvault_service_principal_password can not be empty if both keyvault_service_principal_create and keyvault_service_principal_from_keyvault is disabled!"
}
depends_on = [errorcheck_is_valid.keyvault_service_principal_selector_validation]
}