1
+ variable "resource_group_name" {
2
+ type = string
3
+ description = " Azure Mongo DB Rg"
4
+ default = " "
5
+ }
6
+
7
+ variable "location" {
8
+ type = string
9
+ description = " Azure Mongo DB location"
10
+ default = " "
11
+ }
12
+
13
+ variable "mongodb_cluster_name" {
14
+ description = " Azure Mongo DB name"
15
+ type = string
16
+ default = " "
17
+ }
18
+
19
+ variable "admin_user" {
20
+ description = " Azure Mongo DB admin username"
21
+ type = string
22
+ default = " "
23
+ validation {
24
+ condition = length (var. admin_user ) > 0
25
+ error_message = " The admin_user variable must be set to a non-empty string."
26
+ }
27
+ }
28
+
29
+ variable "environment" {
30
+ default = " DEV"
31
+ description = " Environment tag value in Azure"
32
+ type = string
33
+ validation {
34
+ condition = contains ([" DEV" , " QA" , " UAT" , " PROD" ], var. environment )
35
+ error_message = " Environment value should be one among DEV or QA or UAT or PROD."
36
+ }
37
+ }
38
+
39
+ variable "application_name" {
40
+ default = " devwithkrishna"
41
+ description = " Azure application name tag"
42
+ }
43
+
44
+
45
+ variable "temporary" {
46
+ default = " TRUE"
47
+ description = " Temporary tag value in Azure"
48
+ type = string
49
+ validation {
50
+ condition = contains ([" TRUE" , " FALSE" ], upper (var. temporary ))
51
+ error_message = " The temporary tag value must be either 'TRUE' or 'FALSE'."
52
+ }
53
+
54
+ }
55
+
56
+ variable "compute_tier" {
57
+ description = " The compute tier to assign to the MongoDB Cluster"
58
+ default = " Free"
59
+ type = string
60
+ validation {
61
+ condition = contains ([" Free" , " M10" , " M20" , " M25" , " M30" , " M40" , " M50" , " M60" , " M80" , " M200" ], var. compute_tier )
62
+ error_message = " The compute_tier value must be one of the following: 'Free', 'M10', 'M20', 'M25', 'M30', 'M40', 'M50', 'M60', 'M80', or 'M200'."
63
+ }
64
+ }
65
+
66
+ variable "shard_count" {
67
+ description = " The Number of shards to provision on the MongoDB Cluster"
68
+ type = number
69
+ default = 1
70
+ }
71
+
72
+ variable "public_network_access" {
73
+ default = " Enabled"
74
+ description = " Public Network Access setting for the MongoDB Cluster"
75
+ type = string
76
+ validation {
77
+ condition = contains ([" Enabled" , " Disabled" ], var. public_network_access )
78
+ error_message = " The public_network_access value must be either 'Enabled' or 'Disabled'."
79
+ }
80
+ }
81
+
82
+ variable "storage_size_in_gb" {
83
+ default = 32
84
+ description = " The storage size in GB for the MongoDB Cluster"
85
+ type = number
86
+ }
87
+
88
+ variable "high_availability_mode" {
89
+ description = " The high availability mode for the MongoDB Cluster"
90
+ default = " Disabled"
91
+ type = string
92
+ validation {
93
+ condition = contains ([" ZoneRedundantPreferred" , " Disabled" ], var. high_availability_mode )
94
+ error_message = " The high_availability_mode value must be either 'Disabled', 'ZoneRedundantPreferred'."
95
+ }
96
+ }
97
+
98
+ variable "mongo_create_mode" {
99
+ description = " The create mode for the MongoDB Cluster"
100
+ default = " Default"
101
+ type = string
102
+ validation {
103
+ condition = contains ([" Default" , " GeoReplica" ], var. mongo_create_mode )
104
+ error_message = " The mongo_create_mode value must be either 'Default' or 'GeoReplica'."
105
+ }
106
+
107
+ }
108
+
109
+ variable "mongo_version" {
110
+ description = " The version of the MongoDB Cluster"
111
+ default = " 7.0"
112
+ type = string
113
+ validation {
114
+ condition = contains ([" 5.0" , " 6.0" , " 7.0" ], var. mongo_version )
115
+ error_message = " The mongo_version value must be either '5.0', '6.0', or '7.0'."
116
+ }
117
+
118
+ }
0 commit comments