-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariables.tf
More file actions
691 lines (606 loc) · 16.5 KB
/
Copy pathvariables.tf
File metadata and controls
691 lines (606 loc) · 16.5 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
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
## KV VERSION 2 SECRETS
variable "create_kv_engine" {
type = bool
description = "Enable KV version 2 secret engine"
}
variable "kv_v2_path" {
type = string
default = "infra"
description = "KV-V2 secret engine path"
}
variable "kv_v2_description" {
type = string
default = "Mount path of KV-V2 secret engine"
description = "Just a description"
}
variable "create_kv_v2" {
type = bool
description = "Create KV Version 2 Secrets"
}
variable "kv_v2" {
type = map(object({
sub_path = string
disable_read = bool
delete_all_versions = bool
data_json = any
}))
default = {
"key1" = {
data_json = <<EOF
{
"key1": "value1"
}
EOF
delete_all_versions = true
disable_read = false
sub_path = "path1"
},
"key2" = {
data_json = <<EOF
{
"key2": "value2"
}
EOF
delete_all_versions = true
disable_read = false
sub_path = "path2"
}
}
description = "Key/Value store"
}
variable "max_versions" {
type = number
default = 100
description = "Maximum versions of the secrets"
}
variable "delete_version_after" {
type = number
default = 604800
description = "Old secrets version will be deleted after this seconds (7 days)"
}
## VAULT POLICY
variable "create_policy" {
type = bool
description = "Enable Vault policy or not"
}
variable "vault_policy" {
type = map(object({
name = string
policy = any
}))
default = {
"key1" = {
name = "reader"
policy = <<EOF
## Policy for only reading secrets in this path
path "tfvars/data/*"
{
capabilities = ["read"]
}
EOF
}
}
description = "Policy to read secret by path"
}
## VAULT USERPASS
variable "create_userpass" {
type = bool
description = "Authenticate Vault with Username/Password"
}
variable "userpass_path" {
type = string
default = "userpass"
description = "Mount path for `Userpass` auth method"
}
variable "users_path" {
type = map(object({
path = string
data_json = any
}))
default = {
"user1" = {
data_json = <<EOT
{
"policies": ["POLICY"],
"password": "PASSWORD"
}
EOT
path = "auth/userpass/users/USERNAME"
}
}
description = "The full logical path with `username` suffix"
}
## ASSUMED_ROLE
variable "create_aws_auth_backend" {
type = bool
description = "Enable AWS Auth method or not"
}
variable "aws_auth_path" {
type = string
default = "aws"
description = "AWS Authentication Methods path"
}
variable "create_aws_secret_backend" {
type = bool
default = false
description = "Enable AWS Secret Method or not for Vault"
}
variable "access_key" {
type = string
default = "ACCESS_KEY"
description = "AWS Assumed Role access key"
}
variable "secret_key" {
type = string
default = "SECRET_KEY"
description = "AWS Assumed Role User secret key"
}
variable "default_ttl_aws" {
type = string
default = 1800
description = "Default Time To Live for Assumed role"
}
variable "max_ttl_aws" {
type = string
default = 3600
description = "Maximum Time To Live for Assumed role"
}
variable "aws_secret_path" {
type = string
default = "aws"
description = "AWS Secret Engine path for Assumed Role"
}
variable "create_auth_backend_role" {
type = bool
default = false
description = "Enable STS role or not for Vault"
}
variable "auth_backend_role" {
type = map(object({
account_id = number
sts_role = string
}))
default = {
"key" = {
account_id = 123456789012
sts_role = "arn:aws:iam::123456789012:role/ROLE_NAME"
}
}
description = "Role that will be used by Vault authenticating AWS"
}
variable "create_secret_backend_role" {
type = bool
default = false
description = "Enable a role on an AWS Secret Method or not for Vault"
}
variable "secret_backend_role" {
type = map(object({
name = string
role_arns = list(string)
}))
default = {
"key" = {
name = "aws"
role_arns = ["arn:aws:iam::123456789012:role/ROLE_NAME"]
}
}
description = "Create and use STS Assumed Role by Vault performing necessary actions respectively"
}
variable "credential_type" {
type = string
default = "assumed_role"
description = "AWS STS Assumed Role type"
}
variable "region" {
type = string
default = "us-east-1"
description = "Region that Vault residing"
}
## AWS IAM User
variable "create_aws_auth_backend_user" {
type = bool
description = "Enable AWS Auth method or not"
}
variable "aws_auth_path_user" {
type = string
default = "account_b"
description = "AWS IAM user Authentication Methods path"
}
variable "create_aws_secret_backend_user" {
type = bool
default = false
description = "Vault Enable AWS Secret Method or not"
}
variable "access_key_user" {
type = string
default = "ACCESS_KEY"
description = "AWS Access Key with necessary permissions"
}
variable "secret_key_user" {
type = string
default = "SECRET_KEY"
description = "AWS Secret Key with necessary permissions"
}
variable "default_ttl_user" {
type = number
default = 2700
description = "Default Time To Live for AWS temporary account"
}
variable "max_ttl_user" {
type = number
default = 3600
description = "Maximum Time To Live for AWS temporary account"
}
variable "aws_secret_path_user" {
type = string
default = "account_b"
description = "AWS Secret engine path for IAM User"
}
variable "region_user" {
type = string
default = "us-east-1"
description = "Region that Vault residing"
}
variable "create_auth_backend_role_user" {
type = bool
default = false
description = "Enable STS role or not on Vault"
}
variable "auth_backend_role_user" {
type = map(object({
account_id = number
sts_role = string
}))
default = {
"key" = {
account_id = 13456789012
sts_role = "value"
}
}
description = "If enabled, This Role that will be used by Vault authenticating and performing necessary actions"
}
variable "create_secret_backend_role_user" {
type = bool
default = false
description = "Enable a role on an AWS Secret Method for Vault"
}
variable "secret_backend_role_user" {
type = map(object({
name = string
policy_document = any
}))
default = {
"key" = {
name = "value"
policy_document = {}
}
}
description = "IAM User with defined IAM permission policy respectively"
}
variable "credential_type_user" {
type = string
default = "iam_user"
description = "AWS IAM User type"
}
## GITLAB JWT
variable "enabled_gl_jwt_backend" {
type = bool
description = "Enable GitLab JWT Auth Method or not"
}
variable "gl_jwt_path" {
type = string
default = "jwt-gl"
description = "GitLab JWT Authentication path"
}
variable "bound_issuer" {
type = string
default = "gitlab.com"
description = "The value against which to match the iss claim in a JWT"
}
variable "default_ttl_gl_jwt" {
type = string
default = "1h"
description = "Default Time To Live"
}
variable "max_ttl_gl_jwt" {
type = string
default = "2h"
description = "Maximum Time To Live"
}
variable "gl_jwt_token_type" {
type = string
default = "service"
description = "`service` token or `batch` token? Default is `service` token"
}
variable "create_gl_acc_role" {
type = bool
description = "Enable Account Role for GitHub JWT Auth Method"
}
variable "gl_acc_bound_claims" {
type = map(object({
role_name = string
bound_claims = map(string)
bound_claims_type = string
}))
default = {
"key" = {
bound_claims = {
"project_id" = "12312312"
"ref" = "main,develop"
"ref_type" = "branch"
}
role_name = "ROLE_NAME"
bound_claims_type = "glob"
}
}
description = "JWT/OIDC auth Method role for AWS Account in a Vault server"
}
variable "gl_acc_token_policies" {
type = list(string)
default = ["account_b"]
description = "Vault policy name to attach on AWS Auth Method Role"
}
variable "create_gl_secret_role" {
type = bool
description = "For GitLab, Enable Secrets JWT Auth Method Role or not"
}
variable "gl_secret_bound_claims" {
type = map(object({
role_name = string
bound_claims = map(string)
}))
default = {
"key" = {
bound_claims = {
"project_id" = "123123"
"ref" = "main,develop"
"ref_type" = "branch"
}
role_name = "reader-role"
}
}
description = "JWT/OIDC auth Method role for Secrets values in a Vault server"
}
variable "gl_secret_token_policies" {
type = list(string)
default = ["read-acc_b_creds"]
description = "Secrets policy name"
}
## GITHUB JWT/OIDC
variable "enabled_gh_jwt_backend" {
type = bool
description = "Enable GitHub JWT Auth Method or not"
}
variable "gh_jwt_path" {
type = string
default = "jwt-gh"
description = "GitHub JWT Authentication path"
}
variable "default_ttl_gh_jwt" {
type = string
default = "1h"
description = "Default Time To Live"
}
variable "max_ttl_gh_jwt" {
type = string
default = "2h"
description = "Maximum Time To Live"
}
variable "gh_jwt_token_type" {
type = string
default = "service"
description = "`service` token or `batch` token? Default is `service` token"
}
variable "create_gh_acc_role" {
type = bool
description = "Enable Account Role for GitHub JWT Auth Method"
}
variable "gh_acc_bound_claims" {
type = map(object({
role_name = string
bound_claims = optional(map(string))
token_ttl = number
token_max_ttl = number
}))
default = {
"key1" = {
bound_claims = {
"" = ""
}
role_name = "value"
token_ttl = 300
token_max_ttl = 600
}
}
description = "https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#understanding-the-oidc-token"
}
variable "gh_acc_token_policies" {
type = list(string)
default = [
"default"
]
description = "Vault policy name to attach on AWS Auth Method Role"
}
variable "gh_acc_bound_aud" {
type = list(string)
default = [""]
description = "URL of the repository owner, eg: `https://github.com/OWNER`, such as the organization that owns the repository. This is the only claim that can be customized"
}
variable "gh_acc_bound_sub" {
type = string
default = ""
description = "Defines the subject claim that is to be validated by the cloud provider"
}
variable "create_gh_secret_role" {
type = bool
description = "For GHA, Enable Secrets JWT Auth Method Role or not"
}
variable "gh_secret_bound_claims" {
type = map(object({
role_name = string
bound_claims = optional(map(string))
token_ttl = number
token_max_ttl = number
}))
default = {
"key" = {
bound_claims = {
"" = ""
}
role_name = "value"
token_ttl = 3600
token_max_ttl = 7200
}
}
description = "JWT/OIDC auth Method role for Secrets values in a Vault server"
}
variable "gh_secret_token_policies" {
type = list(string)
default = ["default"]
description = "Secrets policy name"
}
variable "gh_secret_bound_aud" {
type = list(string)
default = [""]
description = "URL of the repository owner, eg: `https://github.com/OWNER`, such as the organization that owns the repository. This is the only claim that can be customized"
}
variable "gh_secret_bound_sub" {
type = string
default = ""
description = "Defines the subject claim that is to be validated by the cloud provider"
}
## KUBERNETES
variable "create_k8s" {
type = bool
description = "Enable Kubernetes Auth Method or not"
}
variable "k8s_path" {
type = map(object({
path = string
}))
default = {
"dev-k8s" = {
path = "dev-k8s"
}
}
description = "Kubernetes Authentication path (Support multi clusters with different paths)"
}
variable "k8s_role" {
type = map(object({
role_name = string
backend = string
bound_service_account_names = list(string)
bound_service_account_namespaces = list(string)
token_policies = list(string)
token_ttl_k8s = number
audience_k8s = string
}))
default = {
"dev-k8s" = {
role_name = "dev-k8s"
backend = "dev-k8s"
bound_service_account_names = ["dev-k8s"]
bound_service_account_namespaces = ["default"]
token_policies = ["default"]
token_ttl_k8s = 3600
audience_k8s = "https://kubernetes.default.svc.cluster.local"
}
}
description = "Kubernetes role to authenticate Vault"
}
variable "k8s_config" {
type = map(object({
backend = string
kubernetes_host = string
kubernetes_ca_cert = string
token_reviewer_jwt = string
issuer = string
}))
default = {
"dev-k8s" = {
backend = "dev-k8s"
kubernetes_host = "https://K8S_HOST_ADDR:6443" # K8S_CLUSTER_ENDPOINT OR PROXY_ENDPOINT [k config view --raw --minify --flatten --output='jsonpath={.clusters[].cluster.server}']
kubernetes_ca_cert = "-----BEGIN CERTIFICATE-----\nASDFQWERQWERASDFASDQ@#RDFADFASDF\n-----END CERTIFICATE-----" # SERVER_CA.crt [k config view --raw --minify --flatten --output='jsonpath={.clusters[].cluster.certificate-authority-data}' | base64 -d]
token_reviewer_jwt = "eyJhbGciOiJSUzI1NiIJASiadura56tIsImtpZCI6InRreml3.ASDFASOIDJFASDKLFLASDF" # SERVICE_ACCOUNT_TOKEN [k get secrets SA_SECRET_NAME -o go-template='{{.data.token}}' | base64 -d]
issuer = "https://kubernetes.default.svc.cluster.local"
}
}
description = "Kubernetes Auth Backend configuration"
}
## OIDC
variable "enabled_oidc_backend" {
type = bool
description = "Enable OIDC Auth Method or not"
}
variable "oidc_auth_path" {
type = map(object({
oidc_path = string
oidc_role = string
oidc_discovery_url = string
oidc_client_id = string
oidc_client_sec = string
}))
default = {
"gmail" = {
oidc_path = "oidc"
oidc_role = "gmail"
oidc_discovery_url = "https://accounts.google.com"
oidc_client_id = "123456789012-5k3hfs5kvc1h82kjkar895ir6118io4bra8q.apps.googleusercontent.com"
oidc_client_sec = "ASDFDF-xRG_MCY1Ulkr8Ke0cBU87yr_XDKR"
}
}
description = "OIDC mount path"
}
variable "oidc_backend_role" {
type = map(object({
oidc_role_name = string
oidc_user_claim = string
oidc_token_type = string
oidc_scopes = list(string)
allowed_redirect_uris = list(string)
oidc_token_policies = list(string)
}))
default = {
"gmail" = {
oidc_role_name = "gmail"
oidc_user_claim = "email"
oidc_token_type = "service"
oidc_scopes = ["openid", "email"]
allowed_redirect_uris = [
"http://127.0.0.1:8250/oidc/callback",
"http://127.0.0.1:8200/ui/vault/auth/oidc/oidc/callback"
]
oidc_token_policies = ["reader"]
}
}
description = "OIDC role to login to Vault"
}
variable "oidc_identity_group" {
type = map(object({
oidc_identity_group_name = string
oidc_identity_type = string
oidc_identity_group_policies = list(string)
tags = map(string)
}))
default = {
"gmail" = {
oidc_identity_group_name = "gmail"
oidc_identity_type = "external"
oidc_identity_group_policies = ["reader"]
tags = {
"Organization" = "OSS"
}
}
}
}
variable "oidc_alias" {
type = map(object({
group_alias_name = string
}))
default = {
"gmail" = {
group_alias_name = "gmail"
}
}
description = "Name of the OIDC group alias"
}