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
|
# Variables ====================================================================
variable "name_prefix" {
description = "Prefix prepended to resource names created by this module"
type = string
validation {
condition = length(trimspace(var.name_prefix)) > 0
error_message = "name_prefix must not be empty."
}
}
variable "tags" {
description = "Tags applied to all resources in this module."
type = map(string)
default = {}
}
variable "resource_shares" {
description = <<-EOT
Map of RAM resource share definitions.
resource_arns and principals are required to be explicitly passed in
to ensure deterministic, auditable sharing relationships.
EOT
type = map(object({
name_suffix = string
resource_arns = list(string)
principals = list(string)
allow_external_principals = optional(bool, false)
permission_arns = optional(list(string))
tags = optional(map(string), {})
}))
default = {}
validation {
condition = alltrue([
for k, v in var.resource_shares : length(trimspace(v.name_suffix)) > 0
])
error_message = "Each resource share must specify a non-empty name_suffix."
}
validation {
condition = alltrue([
for k, v in var.resource_shares : length(v.resource_arns) > 0
])
error_message = "Each resource share must specify at least one resource ARN."
}
validation {
condition = alltrue([
for k, v in var.resource_shares : length(v.principals) > 0
])
error_message = "Each resource share must specify at least one principal."
}
}
|