-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariables.tf
More file actions
66 lines (59 loc) · 2.7 KB
/
variables.tf
File metadata and controls
66 lines (59 loc) · 2.7 KB
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
################################################################################################################
############################### USERS #########################################
################################################################################################################
variable "users" {
description = "List of IAM users to create."
type = list(object({
name = string
path = optional(string, "/")
force_destroy = optional(bool, false)
console_access = optional(bool, false)
password_length = optional(number, 16)
password_reset_required = optional(bool, true)
access_key = optional(bool, false)
groups = optional(list(string), [])
}))
default = []
# Validate that all groups referenced by users exist in var.groups.
validation {
condition = alltrue([
for user in var.users : alltrue([
for group in user.groups : contains([for g in var.groups : g.name], group)
])
])
error_message = "All groups referenced by users must exist in var.groups."
}
}
################################################################################################################
############################### GROUPS #########################################
################################################################################################################
variable "groups" {
description = "List of IAM groups to create, including managed and inline policies"
type = list(object({
name = string
path = optional(string, "/")
managed_policies = optional(list(string), [])
inline_policies = optional(list(object({
name = string
policy = string
})), [])
}))
default = []
# Validate that inline policy names are unique within each group.
validation {
condition = alltrue([
for group in var.groups : (
length(distinct([for p in try(group.inline_policies, []) : p.name])) == length(try(group.inline_policies, []))
)
])
error_message = "Inline policy names must be unique within each group."
}
}
################################################################################################################
############################### TAGS #########################################
################################################################################################################
variable "extra_tags" {
description = "A map of extra tags to add to all resources created by the module."
type = map(string)
default = {}
}