-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariables.tf
More file actions
1627 lines (1370 loc) · 50.1 KB
/
Copy pathvariables.tf
File metadata and controls
1627 lines (1370 loc) · 50.1 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
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#------------------------------------------------------------------------------
# ROSA HCP - Commercial AWS Variables
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Required Variables
#------------------------------------------------------------------------------
variable "rhcs_client_id" {
type = string
description = <<-EOT
RHCS service account client ID for Commercial AWS.
Create a service account at:
https://console.redhat.com/iam/service-accounts
The service account must have "OpenShift Cluster Manager" permissions.
See: https://console.redhat.com/iam/user-access/users
Set via environment variable (recommended):
export TF_VAR_rhcs_client_id="your-client-id"
Note: The offline OCM token is deprecated for commercial cloud.
Service accounts are the recommended authentication method for
both CI/CD pipelines and local workstation use.
EOT
sensitive = false
}
variable "rhcs_client_secret" {
type = string
description = <<-EOT
RHCS service account client secret for Commercial AWS.
Generated when creating a service account at:
https://console.redhat.com/iam/service-accounts
IMPORTANT: Save the client secret when created -- it is only
shown once and cannot be retrieved later.
Set via environment variable (recommended):
export TF_VAR_rhcs_client_secret="your-client-secret"
EOT
sensitive = true
}
variable "cluster_name" {
type = string
description = "Name of the ROSA HCP cluster (1-15 lowercase alphanumeric)."
validation {
condition = can(regex("^[a-z][a-z0-9-]{0,13}[a-z0-9]$", var.cluster_name))
error_message = "Cluster name must be 1-15 lowercase alphanumeric characters, may include hyphens."
}
}
variable "aws_region" {
type = string
description = "AWS region for the cluster."
default = "us-east-1"
validation {
condition = can(regex("^(us|eu|ap|sa|ca|me|af)-(north|south|east|west|central|northeast|southeast)-[0-9]$", var.aws_region))
error_message = "Must be a valid AWS commercial region."
}
}
variable "environment" {
type = string
description = "Environment name (dev, staging, prod)."
default = "dev"
validation {
condition = contains(["dev", "staging", "prod"], var.environment)
error_message = "Environment must be one of: dev, staging, prod."
}
}
#------------------------------------------------------------------------------
# OpenShift Version Configuration
#------------------------------------------------------------------------------
variable "openshift_version" {
type = string
description = "OpenShift version for control plane (e.g., 4.20.14). Run 'rosa list versions' to see available."
default = "4.20.14"
validation {
condition = can(regex("^4\\.[0-9]+\\.[0-9]+$", var.openshift_version))
error_message = "OpenShift version must be in format X.Y.Z."
}
}
variable "machine_pool_version" {
type = string
description = <<-EOT
OpenShift version for machine pools.
Default: Same as openshift_version (control plane).
For upgrades, HCP allows control plane and machine pools to be at
different versions (machine pools must be within n-2 of control plane).
Upgrade workflow:
1. Update openshift_version → control plane upgrades
2. Update machine_pool_version → machine pools upgrade
Set to null to use openshift_version (default, keeps in sync).
EOT
default = null
validation {
condition = var.machine_pool_version == null || can(regex("^4\\.[0-9]+\\.[0-9]+$", var.machine_pool_version))
error_message = "Machine pool version must be null or in format X.Y.Z."
}
}
variable "channel_group" {
type = string
description = "Update channel: stable, fast, candidate, or eus."
default = "stable"
validation {
condition = contains(["stable", "fast", "candidate", "eus"], var.channel_group)
error_message = "Channel must be: stable, fast, candidate, or eus."
}
}
variable "upgrade_acknowledgements_for" {
type = string
description = <<-EOT
Acknowledge upgrade to this version when breaking changes exist.
Required when upgrading to versions with removed Kubernetes APIs.
Example: "4.17" to acknowledge upgrade to 4.17.x
Leave empty/null for normal operations.
EOT
default = null
}
variable "skip_version_drift_check" {
type = bool
description = "Skip version drift validation between control plane and machine pools."
default = false
}
#------------------------------------------------------------------------------
# Network Configuration
#------------------------------------------------------------------------------
variable "vpc_cidr" {
type = string
description = "CIDR block for the VPC."
default = "10.0.0.0/16"
}
variable "availability_zones" {
type = list(string)
description = "List of availability zones. Defaults to auto-select."
default = null
validation {
condition = var.availability_zones == null || try(length(var.availability_zones) >= 1 && length(var.availability_zones) <= 3, false)
error_message = "Must specify 1-3 availability zones."
}
}
variable "multi_az" {
type = bool
description = "Deploy across multiple availability zones (true for production)."
default = false
}
variable "single_nat_gateway" {
type = bool
description = <<-EOT
Use a single shared NAT gateway instead of one per AZ.
- null (default): auto — single-AZ gets 1 NAT, multi-AZ gets 1 per AZ
- true: shared NAT (~$64/month savings for 3-AZ, single point of failure)
- false: dedicated NAT per AZ (high availability)
EOT
default = null
}
variable "egress_type" {
type = string
description = <<-EOT
Type of internet egress for the private subnets:
- "nat": Creates public subnets, Internet Gateway, and NAT gateways (standalone deployment)
- "tgw": No public infrastructure; egress via Transit Gateway (requires transit_gateway_id)
- "proxy": No public infrastructure; egress via HTTP/HTTPS proxy configured in cluster
- "none": No public infrastructure, no egress (zero-egress/air-gapped, HCP only)
Note: When zero_egress = true, egress_type is automatically set to "none".
EOT
default = "nat"
validation {
condition = contains(["nat", "tgw", "proxy"], var.egress_type)
error_message = "egress_type must be one of: nat, tgw, proxy"
}
}
variable "transit_gateway_id" {
type = string
description = "Transit Gateway ID for egress routing (when egress_type = 'tgw')."
default = null
}
variable "transit_gateway_route_cidr" {
type = string
description = "CIDR block to route via Transit Gateway (typically 0.0.0.0/0 for internet egress)."
default = "0.0.0.0/0"
}
variable "enable_route53_query_logging" {
type = bool
description = "Enable Route53 Resolver query logging for the VPC. Logs all DNS queries originating from the VPC to CloudWatch."
default = false
}
variable "resolver_query_log_retention_days" {
type = number
description = "Number of days to retain Route53 Resolver query logs in CloudWatch."
default = 30
}
variable "resolver_query_log_group_name" {
type = string
description = "Custom CloudWatch log group name for Resolver query logs. Defaults to /aws/route53resolver/{cluster_name}-vpc."
default = null
}
variable "private_subnet_cidrs" {
type = list(string)
description = "CIDR blocks for private subnets. Auto-calculated if null."
default = null
}
variable "public_subnet_cidrs" {
type = list(string)
description = "CIDR blocks for public subnets. Auto-calculated if null."
default = null
}
#------------------------------------------------------------------------------
# BYO-VPC Configuration (Optional)
#
# Deploy into an existing VPC instead of creating a new one.
# When existing_vpc_id is set, the VPC module is skipped entirely.
# The number of private subnets determines cluster topology:
# - 1 subnet = single-AZ cluster
# - 3 subnets = multi-AZ cluster
#
# See docs/BYO-VPC.md for CIDR planning and multi-cluster guidance.
#------------------------------------------------------------------------------
variable "existing_vpc_id" {
type = string
description = <<-EOT
ID of an existing VPC to deploy into (BYO-VPC).
When set, skips VPC creation and uses provided subnet IDs.
The VPC must have:
- DNS hostnames enabled
- DNS resolution enabled
- Appropriate tags for ROSA (kubernetes.io/cluster/<name>)
EOT
default = null
}
variable "existing_private_subnet_ids" {
type = list(string)
description = <<-EOT
Private subnet IDs in the existing VPC. Required when existing_vpc_id is set.
The number of subnets determines cluster topology:
- 1 subnet = single-AZ cluster (dev/test)
- 3 subnets = multi-AZ cluster (production HA)
Each subnet must be in a different AZ for multi-AZ deployments.
Subnets must be tagged with: kubernetes.io/role/internal-elb = 1
EOT
default = null
validation {
condition = var.existing_private_subnet_ids == null ? true : contains([1, 3], length(var.existing_private_subnet_ids))
error_message = "Provide 1 subnet (single-AZ) or 3 subnets (multi-AZ). Other counts are not supported by ROSA."
}
}
variable "existing_public_subnet_ids" {
type = list(string)
description = <<-EOT
Public subnet IDs in the existing VPC. Required for public clusters with BYO-VPC.
Must match the same AZ count as existing_private_subnet_ids.
Subnets must be tagged with: kubernetes.io/role/elb = 1
EOT
default = null
}
variable "pod_cidr" {
type = string
description = <<-EOT
CIDR block for pod network.
Default is safe for a single cluster. For multi-cluster in the same VPC,
each cluster needs a unique pod CIDR to avoid routing conflicts.
Examples for multi-cluster:
Cluster 1: 10.128.0.0/14 (default)
Cluster 2: 10.132.0.0/14
EOT
default = "10.128.0.0/14"
}
variable "service_cidr" {
type = string
description = <<-EOT
CIDR block for service network.
Default is safe for a single cluster. For multi-cluster in the same VPC,
each cluster needs a unique service CIDR.
Examples for multi-cluster:
Cluster 1: 172.30.0.0/16 (default)
Cluster 2: 172.31.0.0/16
EOT
default = "172.30.0.0/16"
}
variable "host_prefix" {
type = number
description = "Subnet prefix length assigned to each node for pod IPs."
default = 23
}
#------------------------------------------------------------------------------
# Cluster Configuration
#------------------------------------------------------------------------------
variable "private_cluster" {
type = bool
description = <<-EOT
Deploy as a private cluster (no public API/ingress endpoints).
- true (default): API and ingress only accessible from within VPC
* Requires jump host or VPN for access
* More secure for production workloads
- false: Public API and ingress endpoints
* Direct access from internet
* Simpler setup for development
Note: HCP control plane connectivity ALWAYS uses AWS PrivateLink
(workers connect to Red Hat-managed control plane via PrivateLink).
This setting only controls whether API/ingress endpoints are public.
EOT
default = true
}
variable "fips" {
type = bool
description = <<-EOT
Enable FIPS-validated cryptographic modules on the cluster.
- Immutable after cluster creation (cannot be changed later)
- Required for GovCloud (automatically set to true there)
- Optional for Commercial (default false)
When enabled, all cluster nodes use FIPS-validated crypto libraries.
EOT
default = false
}
variable "zero_egress" {
type = bool
description = <<-EOT
Enable zero-egress mode for fully air-gapped operation (HCP only).
When enabled:
- Cluster pulls OpenShift images from Red Hat's regional ECR
- No NAT gateway or internet gateway required
- Custom operators must be mirrored to your own ECR
Requirements:
- private_cluster must be true
- VPN or jump host for cluster access
- Operator mirroring workflow (see docs/ZERO-EGRESS.md)
EOT
default = false
}
#------------------------------------------------------------------------------
# ECR Configuration (Optional)
#------------------------------------------------------------------------------
variable "create_ecr" {
type = bool
description = <<-EOT
Create an ECR repository for container images.
Use cases:
- Private container registry for custom application images
- Operator mirroring for zero-egress clusters
When enabled, automatically attaches ECR pull policy to worker nodes.
EOT
default = false
}
variable "ecr_repository_name" {
type = string
description = "Custom ECR repository name. Defaults to {cluster_name}-registry."
default = ""
}
variable "ecr_prevent_destroy" {
type = bool
description = <<-EOT
Prevent ECR repository from being destroyed with the cluster.
When true:
- Repository survives terraform destroy of the cluster
- Useful for shared registries or preserving images across cluster rebuilds
To destroy when prevent_destroy = true:
1. Set ecr_prevent_destroy = false in tfvars
2. Run: terraform destroy -target=module.ecr
EOT
default = false
}
variable "ecr_create_vpc_endpoints" {
type = bool
description = <<-EOT
Create VPC endpoints for ECR (ecr.api and ecr.dkr).
Defaults to true because:
1. Cost efficiency - Avoids NAT Gateway egress charges for image pulls
2. Required for zero-egress - Clusters without internet need private ECR access
3. Security - All ECR traffic stays within AWS private network
Set to false if using shared VPC with existing ECR endpoints.
EOT
default = true
}
variable "compute_machine_type" {
type = string
description = "EC2 instance type for worker nodes."
default = "m6i.xlarge"
}
variable "worker_node_count" {
type = number
description = "Number of worker nodes in default pool."
default = 2
validation {
condition = var.worker_node_count >= 2
error_message = "HCP requires at least 2 worker nodes."
}
}
#------------------------------------------------------------------------------
# KMS Encryption Configuration
#
# Two separate keys with independent modes for blast radius containment:
# - cluster_kms_*: For ROSA workers and etcd ONLY
# - infra_kms_*: For jump host, CloudWatch, S3/OADP, VPN ONLY
#------------------------------------------------------------------------------
variable "cluster_kms_mode" {
type = string
description = <<-EOT
Cluster KMS key management mode:
- "provider_managed" (DEFAULT): Use AWS managed aws/ebs key - simplest, no KMS costs
- "create": Terraform creates a customer-managed KMS key
- "existing": Use an existing KMS key ARN (set cluster_kms_key_arn)
This key is used ONLY for ROSA-managed resources (workers, etcd).
All modes provide encryption at rest.
EOT
default = "provider_managed"
validation {
condition = contains(["provider_managed", "create", "existing"], var.cluster_kms_mode)
error_message = "cluster_kms_mode must be one of: provider_managed, create, existing"
}
}
variable "cluster_kms_key_arn" {
type = string
description = "ARN of existing KMS key for cluster. Required when cluster_kms_mode = 'existing'."
default = null
}
variable "infra_kms_mode" {
type = string
description = <<-EOT
Infrastructure KMS key management mode:
- "provider_managed" (DEFAULT): Use AWS managed aws/ebs key - simplest, no KMS costs
- "create": Terraform creates a customer-managed KMS key
- "existing": Use an existing KMS key ARN (set infra_kms_key_arn)
This key is used ONLY for non-ROSA resources:
- Jump host EBS volumes
- CloudWatch log encryption
- S3 bucket encryption (OADP, backups)
- VPN connection logs
IMPORTANT: Separate from cluster KMS for blast radius containment.
EOT
default = "provider_managed"
validation {
condition = contains(["provider_managed", "create", "existing"], var.infra_kms_mode)
error_message = "infra_kms_mode must be one of: provider_managed, create, existing"
}
}
variable "infra_kms_key_arn" {
type = string
description = "ARN of existing KMS key for infrastructure. Required when infra_kms_mode = 'existing'."
default = null
}
variable "etcd_encryption" {
type = bool
description = <<-EOT
Enable etcd encryption at rest using customer-managed KMS key.
Only applies when cluster_kms_mode = "create" or "existing".
When cluster_kms_mode = "provider_managed", etcd uses AWS managed encryption.
Recommended: true for production workloads with sensitive data.
EOT
default = false
}
#------------------------------------------------------------------------------
# Admin User Configuration
#------------------------------------------------------------------------------
variable "create_admin_user" {
type = bool
description = "Create htpasswd admin user."
default = true
}
variable "admin_username" {
type = string
description = "Admin username."
default = "cluster-admin"
}
#------------------------------------------------------------------------------
# Additional Machine Pools Configuration
#
# Generic list of machine pools for any workload type.
# See docs/MACHINE-POOLS.md for examples: GPU, bare metal, ARM/Graviton, etc.
#------------------------------------------------------------------------------
variable "machine_pools" {
type = list(object({
name = string
instance_type = string
replicas = optional(number, 2)
autoscaling = optional(object({
enabled = bool
min = number
max = number
}))
labels = optional(map(string), {})
taints = optional(list(object({
key = string
value = string
schedule_type = string
})), [])
availability_zone = optional(string)
subnet_id = optional(string)
attach_ecr_policy = optional(bool, false)
}))
description = <<-EOT
List of additional machine pools to create.
Each pool object supports:
- name: Pool name (required)
- instance_type: EC2 instance type (required)
- replicas: Fixed replica count (default: 2, ignored if autoscaling enabled)
- autoscaling: { enabled = bool, min = number, max = number }
- labels: Map of node labels for workload targeting
- taints: List of taints for workload isolation
- availability_zone: Target a specific AZ (for instance types with limited AZ support)
- subnet_id: Override default subnet (alternative to availability_zone)
- attach_ecr_policy: Attach ECR readonly policy to pool (default: false)
Examples in docs/MACHINE-POOLS.md:
- GPU pools (NVIDIA g4dn, p3, p4d)
- Bare metal pools (m6i.metal for OpenShift Virtualization)
- ARM/Graviton pools (m6g, m7g for cost optimization)
- High memory pools (r5, x2idn)
Note: HCP spot instances coming soon. See Classic for current spot support.
EOT
default = []
}
#------------------------------------------------------------------------------
# Cluster Autoscaler Configuration
#
# The cluster autoscaler controls cluster-wide scaling behavior.
# For ROSA HCP, it's fully managed by Red Hat (runs with control plane).
#
# Both cluster autoscaler AND machine pool autoscaling must be enabled
# for automatic scaling to work.
#------------------------------------------------------------------------------
variable "cluster_autoscaler_enabled" {
type = bool
description = <<-EOT
Enable the cluster autoscaler for automatic cluster sizing.
The cluster autoscaler:
- Adds nodes when pods can't be scheduled due to insufficient resources
- Removes underutilized nodes (default 50% utilization threshold)
- Only affects machine pools that have autoscaling enabled
EOT
default = false
}
variable "autoscaler_max_nodes_total" {
type = number
description = <<-EOT
Maximum number of nodes across all autoscaling machine pools.
Nodes in non-autoscaling pools are NOT counted toward this limit.
EOT
default = 100
}
variable "autoscaler_max_node_provision_time" {
type = string
description = <<-EOT
Maximum time the autoscaler waits for a node to become ready.
Format: duration string (e.g., "15m", "30m")
EOT
default = "25m"
}
variable "autoscaler_max_pod_grace_period" {
type = number
description = "Graceful termination time in seconds for pods during scale down."
default = 600
}
variable "autoscaler_pod_priority_threshold" {
type = number
description = <<-EOT
Priority threshold for pod scheduling.
Pods below this priority won't trigger scale up or prevent scale down.
EOT
default = -10
}
#------------------------------------------------------------------------------
# Jump Host Configuration
#------------------------------------------------------------------------------
variable "create_jumphost" {
type = bool
description = "Create SSM-enabled jump host for private cluster access."
default = false
}
variable "jumphost_instance_type" {
type = string
description = "EC2 instance type for the jump host."
default = "t3.micro"
}
variable "jumphost_ami_id" {
type = string
description = "AMI ID for the jump host. If null, uses latest Amazon Linux 2023."
default = null
}
#------------------------------------------------------------------------------
# Client VPN Configuration
# Note: The client-vpn module generates its own certificates automatically
#------------------------------------------------------------------------------
variable "create_client_vpn" {
type = bool
description = <<-EOT
Create AWS Client VPN endpoint for direct cluster access.
The module generates certificates automatically - no ACM setup required.
Cost: ~$116/month. Create/destroy takes 15-25 minutes.
Consider using jump host (SSM) for cost savings.
EOT
default = false
}
variable "vpn_client_cidr_block" {
type = string
description = <<-EOT
CIDR block for VPN client IP addresses. Must not overlap with VPC CIDR.
Minimum /22 (1024 addresses). AWS reserves half for HA.
EOT
default = "10.100.0.0/22"
}
variable "vpn_split_tunnel" {
type = bool
description = "Enable split tunnel (only VPC traffic through VPN). Recommended: true."
default = true
}
variable "vpn_session_timeout_hours" {
type = number
description = "VPN session timeout in hours (8-24)."
default = 12
}
#------------------------------------------------------------------------------
# Tags
#------------------------------------------------------------------------------
variable "tags" {
type = map(string)
description = "Tags to apply to all resources."
default = {}
}
#------------------------------------------------------------------------------
# GitOps Configuration
#------------------------------------------------------------------------------
variable "install_gitops" {
type = bool
description = <<-EOT
Install OpenShift GitOps operator and layers framework.
RECOMMENDED: Deploy in two stages for reliability:
Stage 1 - Infrastructure (default):
terraform apply -var-file=dev.tfvars
# Creates VPC, IAM, ROSA cluster
Stage 2 - GitOps (when ready):
terraform apply -var-file=dev.tfvars -var="install_gitops=true"
# Installs GitOps operator and configured layers
For zero-egress clusters: Mirror required operators to ECR before Stage 2.
See docs/DISCONNECTED-OPERATIONS.md for operator mirroring guide.
Set to false when destroying to skip GitOps connectivity checks:
terraform destroy -var="install_gitops=false" -var-file=dev.tfvars
EOT
default = false
}
variable "gitops_repo_url" {
type = string
description = <<-EOT
Git repository URL for ADDITIONAL custom resources to deploy via ArgoCD.
This does NOT replace the built-in layers (monitoring, OADP, etc.) which
are always managed by Terraform. Use this for your own static manifests
(projects, quotas, RBAC, apps). When provided, an ArgoCD Application
is created to sync from this repo.
EOT
default = null
}
variable "gitops_repo_path" {
type = string
description = "Path within repository for GitOps manifests."
default = null
}
variable "gitops_repo_revision" {
type = string
description = "Git revision (branch, tag, commit) for GitOps repository."
default = null
}
variable "gitops_oauth_url" {
type = string
description = <<-EOT
OAuth server URL for GitOps authentication (optional).
If not set, automatically derived from cluster API URL:
API URL: https://api.<cluster>.<domain>:6443
OAuth URL: https://oauth-openshift.apps.<cluster>.<domain>
Set this if:
- Using HCP with external authentication
- Older OpenShift version with different OAuth routing
- Custom OAuth configuration
Discovery: oc get route -n openshift-authentication oauth-openshift -o jsonpath='{.spec.host}'
EOT
default = null
}
variable "gitops_cluster_token" {
type = string
description = <<-EOT
Pre-provided cluster token for GitOps authentication (optional).
If set, skips OAuth token retrieval and uses this token directly.
Useful for HCP clusters with external auth (OIDC, LDAP) where
htpasswd IDP is not available.
To obtain: oc login <cluster> && oc whoami -t
EOT
default = null
sensitive = true
}
variable "enable_layer_terminal" {
type = bool
description = "Enable Web Terminal layer."
default = false
}
variable "enable_layer_oadp" {
type = bool
description = "Enable OADP (backup) layer."
default = false
}
variable "oadp_backup_retention_days" {
type = number
description = <<-EOT
Number of days to retain backups.
Controls both Velero backup TTL and S3 lifecycle rules.
EOT
default = 30
}
variable "enable_layer_virtualization" {
type = bool
description = "Enable Virtualization layer."
default = false
}
variable "enable_layer_monitoring" {
type = bool
description = <<-EOT
Enable the Monitoring and Logging layer.
Installs Prometheus with persistent storage and Loki with S3 backend.
Creates S3 bucket and IAM role for Loki log storage.
EOT
default = false
}
variable "monitoring_loki_size" {
type = string
description = <<-EOT
LokiStack deployment size. Controls resource allocation for all Loki components.
Available sizes:
- 1x.extra-small: Development/testing (default, ~2 vCPU, 4GB per component)
- 1x.small: Small production (~4 vCPU, 8GB per component, requires 6+ nodes)
- 1x.medium: Medium production (~8 vCPU, 16GB per component)
IMPORTANT: 1x.small and larger require significant cluster resources.
For dev environments with m6i.xlarge nodes, use 1x.extra-small.
EOT
default = "1x.extra-small"
}
variable "monitoring_retention_days" {
type = number
description = <<-EOT
Retention period for metrics and logs in days.
Controls both Prometheus retention and Loki compactor retention.
Recommended: 7 for dev, 30 for production.
EOT
default = 30
}
variable "monitoring_prometheus_storage_size" {
type = string
description = <<-EOT
Size of Prometheus persistent volume.
Recommended: 50Gi for 7-day retention, 100Gi for 30-day retention.
EOT
default = "100Gi"
}
variable "monitoring_storage_class" {
type = string
description = "StorageClass for Prometheus and Loki PVCs."
default = "gp3-csi"
}
variable "monitoring_node_selector" {
type = map(string)
description = <<-EOT
Node selector for LokiStack components.
Use to place Loki on dedicated monitoring nodes.
Example: { "node-role.kubernetes.io/monitoring" = "" }
Default: {} (no node selector, uses default scheduling)
EOT
default = {}
}
variable "monitoring_tolerations" {
type = list(object({
key = string
operator = optional(string, "Equal")
value = optional(string, "")
effect = string
}))
description = <<-EOT
Tolerations for LokiStack components.
Use to allow Loki to run on tainted monitoring nodes.
Example: [{ key = "workload", value = "monitoring", effect = "NoSchedule" }]
Default: [] (no tolerations, uses default scheduling)
EOT
default = []
}
#------------------------------------------------------------------------------
# Cert-Manager Layer Configuration
#------------------------------------------------------------------------------
variable "enable_layer_certmanager" {
type = bool
description = <<-EOT
Enable the Cert-Manager layer for automated certificate lifecycle management.
Installs the OpenShift cert-manager operator and configures Let's Encrypt
with DNS01/Route53 challenge for automatic certificate provisioning.
IMPORTANT: Requires outbound internet access for ACME challenges.
Cannot be used on zero-egress clusters.
EOT
default = false
}
variable "certmanager_hosted_zone_id" {
type = string
description = <<-EOT
Route53 hosted zone ID for DNS01 challenges.
Required when not creating a new hosted zone.
EOT
default = ""
}
variable "certmanager_hosted_zone_domain" {
type = string
description = <<-EOT
Domain for the Route53 hosted zone.
Required when creating a new hosted zone (certmanager_create_hosted_zone = true).
Example: "apps.example.com"
EOT
default = ""
}
variable "certmanager_create_hosted_zone" {
type = bool
description = <<-EOT
Whether to create a new Route53 hosted zone for cert-manager.
If false, provide certmanager_hosted_zone_id for an existing zone.
EOT
default = false
}
variable "certmanager_enable_dnssec" {
type = bool
description = <<-EOT
Enable DNSSEC signing on the cert-manager Route53 hosted zone.
Only applies when certmanager_create_hosted_zone = true.
DNSSEC protects against DNS spoofing and cache poisoning.
After enabling, add the DS record from outputs to your domain registrar
to complete the chain of trust.
EOT
default = true
}
variable "certmanager_enable_query_logging" {
type = bool
description = <<-EOT
Enable DNS query logging for the cert-manager Route53 hosted zone.
Only applies when certmanager_create_hosted_zone = true.
IMPORTANT: For Commercial AWS, Route53 query logging requires the
CloudWatch log group in us-east-1. Set to false for other regions.
For GovCloud, works in any deployment region.
EOT
default = true
}