-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvariables.tf
217 lines (177 loc) · 7.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
/* -------------------------------------------------------------------------- */
/* Generic */
/* -------------------------------------------------------------------------- */
variable "environment" {
description = "Environment Variable used as a prefix"
type = string
}
variable "prefix" {
description = "The prefix name of customer to be displayed in AWS console and resource"
type = string
}
variable "tags" {
description = "Custom tags which can be passed on to the AWS resources. They should be key value pairs having distinct keys"
type = map(any)
default = {}
}
/* -------------------------------------------------------------------------- */
/* GitHub OIDC */
/* -------------------------------------------------------------------------- */
variable "is_create_github_oidc" {
type = bool
description = "Flag to enable/disable the creation of GitHub OIDC resources."
default = true
}
variable "is_create_oidc_provider" {
default = true
description = "Flag to enable/disable the creation of the GitHub OIDC provider."
type = bool
}
variable "github_actions_oidc_url" {
type = string
description = "The URL to use for the OIDC handshake"
default = "https://token.actions.githubusercontent.com"
validation {
condition = substr(var.github_actions_oidc_url, 0, 5) == "https"
error_message = "The OIDC URL needs to start with https."
}
}
variable "github_repositories" {
description = "List of GitHub organization/repository names authorized to assume the role."
type = list(string)
validation {
// Ensures each element of github_repositories list matches the organization/repository format used by GitHub.
condition = length([
for repo in var.github_repositories : 1
if length(regexall("^[A-Za-z0-9_.-]+?/([A-Za-z0-9_.:/-]+|\\*)$", repo)) > 0
]) == length(var.github_repositories)
error_message = "Repositories must be specified in the organization/repository format."
}
}
variable "github_thumbprint" {
default = "6938fd4d98bab03faadb97b34396831e3780aea1"
description = "GitHub OpenID TLS certificate thumbprint."
type = string
}
/* -------------------------------------------------------------------------- */
/* SHARED_ROLE_ARNS */
/* -------------------------------------------------------------------------- */
variable "readonly_policy_arn" {
description = "AWS built in readonly access policy arn"
type = string
default = "arn:aws:iam::aws:policy/ReadOnlyAccess"
}
variable "securityaudit_policy_arn" {
description = "AWS built in securityaudit access policy arn"
type = string
default = "arn:aws:iam::aws:policy/SecurityAudit"
}
variable "ecr_readonly_policy_arn" {
description = "AWS built in ECR readonly access policy arn"
type = string
default = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
}
variable "ecr_poweruser_policy_arn" {
description = "AWS built in ECR PowerUser access policy arn"
type = string
default = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryPowerUser"
}
variable "ecs_fullaccess_policy_arn" {
description = "AWS built in ECS full access policy arn"
type = string
default = "arn:aws:iam::aws:policy/AmazonECS_FullAccess"
}
/* -------------------------------------------------------------------------- */
/* SHARED_ROLE_VARIABLES */
/* -------------------------------------------------------------------------- */
variable "role_name_suffix" {
description = "IAM role name to be <role_name><role_name_suffix>"
type = string
default = "GithubOIDCRole"
}
variable "iam_role_path" {
default = "/"
description = "Path under which to create IAM role."
type = string
}
variable "iam_role_permissions_boundary" {
default = ""
description = "ARN of the permissions boundary to be used by the IAM role."
type = string
}
variable "max_session_duration" {
default = 3600
description = "Maximum session duration in seconds."
type = number
validation {
condition = var.max_session_duration >= 3600 && var.max_session_duration <= 43200
error_message = "Maximum session duration must be between 3600 and 43200 seconds."
}
}
variable "force_detach_policies" {
default = false
description = "Flag to force detachment of policies attached to the IAM role."
type = string
}
/* -------------------------------------------------------------------------- */
/* CUSTOM_USER_ROLE */
/* -------------------------------------------------------------------------- */
variable "is_create_custom_oicd_role" {
description = "Whether to create custom oidc role"
type = bool
default = false
}
variable "custom_role_name_prefix" {
description = "IAM role name to be <role_name>-GithubOIDCRole"
type = string
default = "custom"
}
variable "custom_role_iam_policy_arns" {
description = "AWS built in policies for custom role"
type = list(string)
default = []
}
variable "custom_iam_role_inline_policies" {
default = {}
description = "Inline policies map with policy name as key and json as value."
type = map(string)
}
/* -------------------------------------------------------------------------- */
/* SECURITY_SCAN_OIDC_ROLE */
/* -------------------------------------------------------------------------- */
variable "is_create_securityscan_oicd_role" {
description = "Whether to create securityscan oidc role"
type = bool
default = false
}
variable "securityscan_role_name_prefix" {
description = "IAM role name to be <role_name>-GithubOIDCRole"
type = string
default = "SecurityScan"
}
/* -------------------------------------------------------------------------- */
/* ECR_OIDC_ROLE */
/* -------------------------------------------------------------------------- */
variable "is_create_ecrpush_oicd_role" {
description = "Whether to create ecr readwrite oidc role"
type = bool
default = false
}
variable "ecrpush_role_name_prefix" {
description = "IAM role name to be <role_name>-GithubOIDCRole"
type = string
default = "ECR_ReadWrite"
}
/* -------------------------------------------------------------------------- */
/* ECS_OIDC_ROLE */
/* -------------------------------------------------------------------------- */
variable "is_create_ecs_oicd_role" {
description = "Whether to create ecs full access oidc role"
type = bool
default = false
}
variable "ecs_role_name_prefix" {
description = "IAM role name to be <role_name>-GithubOIDCRole"
type = string
default = "ECS_FullAccess"
}