forked from swift2geek/AzureProblem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariables.tf
More file actions
145 lines (123 loc) · 3.49 KB
/
Copy pathvariables.tf
File metadata and controls
145 lines (123 loc) · 3.49 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
# General variables
variable "project_name" {
description = "Project name, used for resource naming"
type = string
default = "secure-db"
}
variable "environment" {
description = "Environment (dev, staging, prod)"
type = string
default = "dev"
validation {
condition = contains(["dev", "staging", "prod"], var.environment)
error_message = "Environment must be one of: dev, staging, prod."
}
}
variable "location" {
description = "Azure region for resource deployment"
type = string
default = "West Europe"
}
variable "resource_group_name" {
description = "Resource group name"
type = string
default = null
}
# Network variables
variable "vnet_address_space" {
description = "CIDR block for virtual network"
type = list(string)
default = ["10.0.0.0/16"]
}
variable "database_subnet_address_prefixes" {
description = "CIDR block for database subnet"
type = list(string)
default = ["10.0.1.0/24"]
}
variable "private_endpoint_subnet_address_prefixes" {
description = "CIDR block for private endpoint subnet"
type = list(string)
default = ["10.0.2.0/24"]
}
# Database variables
variable "cosmos_db_name" {
description = "Cosmos DB account name"
type = string
default = null
}
variable "database_throughput" {
description = "Database throughput (RU/s)"
type = number
default = 400
validation {
condition = var.database_throughput >= 400 && var.database_throughput <= 1000000
error_message = "Database throughput must be between 400 and 1000000 RU/s."
}
}
variable "backup_retention_days" {
description = "Number of days to retain backups"
type = number
default = 7
validation {
condition = var.backup_retention_days >= 1 && var.backup_retention_days <= 35
error_message = "Backup retention period must be between 1 and 35 days."
}
}
# Security variables
variable "enable_private_endpoint" {
description = "Enable private endpoint for database"
type = bool
default = true
}
variable "allowed_ip_ranges" {
description = "List of IP addresses/ranges allowed to access the database"
type = list(string)
default = []
}
variable "enable_encryption_at_rest" {
description = "Enable encryption at rest"
type = bool
default = true
}
variable "enable_audit_logging" {
description = "Enable audit logging"
type = bool
default = true
}
# Key Vault variables
variable "key_vault_sku" {
description = "SKU for Key Vault"
type = string
default = "standard"
validation {
condition = contains(["standard", "premium"], var.key_vault_sku)
error_message = "Key Vault SKU must be standard or premium."
}
}
# Tags
variable "common_tags" {
description = "Common tags for all resources"
type = map(string)
default = {
Project = "SecureDatabase"
ManagedBy = "Terraform"
Owner = "Platform Team"
Environment = "dev"
}
}
# RBAC variables
variable "database_administrators" {
description = "List of users/groups with administrative rights on the database"
type = list(string)
default = []
}
variable "database_readers" {
description = "List of users/groups with read access to the database"
type = list(string)
default = []
}
variable "database_writers" {
description = "List of users/groups with write access to the database"
type = list(string)
default = []
}