generated from clouddrove/terraform-module-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.yaml
192 lines (171 loc) · 8.26 KB
/
README.yaml
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
---
#
# This is the canonical configuration for the `README.md`
# Run `make readme` to rebuild the `README.md`
#
# Name of this project
name: Terraform AZURE flexible-postgresql
# License of this project
license: "APACHE"
# Canonical GitHub repo
github_repo: clouddrove/terraform-azure-flexible-postgresql
# Badges to display
badges:
- name: "Latest Release"
image: "https://img.shields.io/github/release/clouddrove/terraform-azure-flexible-postgresql.svg"
url: "https://github.com/clouddrove/terraform-azure-flexible-postgresql/releases/latest"
- name: "tfsec"
image: "https://github.com/clouddrove/terraform-azure-flexible-postgresql/actions/workflows/tfsec.yml/badge.svg"
url: "https://github.com/clouddrove/terraform-azure-flexible-postgresql/actions/workflows/tfsec.yml"
- name: "Licence"
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
url: "LICENSE.md"
# description of this project
description: |-
Terraform module to create VIRTUAL-NETWORK resource on AZURE.
# extra content
include:
- "terraform.md"
# How to use this project
# yamllint disable rule:line-length
usage: |-
### Basic Example
```hcl
module "flexible-postgresql" {
source = "../.."
name = "app"
resource_group_name = "test"
location = "Canada Central"
#**************************server configuration***************************
postgresql_version = "16"
admin_username = "postgresqlusername"
admin_password = "ba5yatgfgfhdsv6A3ns2lu4gqzzc" # Null value will generate random password and added to tfstate file.
tier = "Burstable"
size = "B1ms"
database_names = ["maindb"]
#high_availability is applicable if tier are GeneralPurpose and MemoryOptimized.
high_availability = {
mode = "ZoneRedundant"
standby_availability_zone = 2
}
#Entra_id Group name or user who can log into database.
principal_name = "Database_Admins"
#**************************private server*********************************
#(Resources to recreate when changing private to public cluster or vise-versa )
virtual_network_id = ""
private_dns = false
delegated_subnet_id = null
#**************************Logging*****************************************
# By default diagnostic setting is enabled and logs are set AuditLogs and All_Metric. To disable logging set enable_diagnostic to false.
enable_diagnostic = false
log_analytics_workspace_id = "/subscription/***************"
#**************************Encryption**************************************
# Database encryption with costumer manage keys
cmk_encryption_enabled = false
key_vault_id = "/subscription/***************"
admin_objects_ids = [data.azurerm_client_config.current_client_config.object_id]
}
```
### Complete Example
```hcl
module "flexible-postgresql" {
depends_on = [module.resource_group, module.vnet]
source = "../.."
name = local.name
environment = local.environment
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
#**************************server configuration***************************
postgresql_version = "16"
admin_username = "postgresqlusername"
admin_password = "ba5yatgfgfhdsv6A3ns2lu4gqzzc" # Null value will generate random password and added to tfstate file.
tier = "Burstable"
size = "B1ms"
database_names = ["maindb"]
#high_availability is applicable if tier are GeneralPurpose and MemoryOptimized.
high_availability = {
mode = "ZoneRedundant"
standby_availability_zone = 2
}
#Entra_id Group name or user who can log into database.
principal_name = "Database_Admins"
#**************************private server*********************************
#(Resources to recreate when changing private to public cluster or vise-versa )
virtual_network_id = module.vnet.vnet_id
private_dns = true
delegated_subnet_id = module.subnet.default_subnet_id[0]
#**************************Logging*****************************************
# By default diagnostic setting is enabled and logs are set AuditLogs and All_Metric. To disable logging set enable_diagnostic to false.
log_analytics_workspace_id = module.log-analytics.workspace_id
#**************************Encryption**************************************
# Database encryption with costumer manage keys
cmk_encryption_enabled = true
key_vault_id = module.vault.id
admin_objects_ids = [data.azurerm_client_config.current_client_config.object_id]
}
```
### flexible-pgsql-public Example
```hcl
module "flexible-postgresql" {
depends_on = [module.resource_group]
source = "../.."
name = local.name
environment = local.environment
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
#**************************server configuration***************************
postgresql_version = "16"
admin_username = "postgresqlusername"
admin_password = "ba5yatgfgfhdsv6A3ns2lu4gqzzc" # Null value will generate random password and added to tfstate file.
tier = "Burstable"
size = "B1ms"
database_names = ["maindb"]
#high_availability is applicable if tier are GeneralPurpose and MemoryOptimized.
high_availability = {
mode = "ZoneRedundant"
standby_availability_zone = 2
}
#Entra_id Group name or user who can log into database.
principal_name = "Database_Admins"
#**************************Public server*********************************
allowed_cidrs = {
"allowed_all_ip" = "0.0.0.0/0"
"allowed_specific_ip" = "11.32.16.78/32"
}
#**************************Logging*****************************************
# By default diagnostic setting is enabled and logs are set AuditLogs and All_Metric. To disable logging set enable_diagnostic to false.
log_analytics_workspace_id = module.log-analytics.workspace_id
#**************************Encryption**************************************
# Database encryption with costumer manage keys
cmk_encryption_enabled = true
key_vault_id = module.vault.id
admin_objects_ids = [data.azurerm_client_config.current_client_config.object_id]
}
```
### pgsql-server-replication Example
```hcl
module "flexible-postgresql" {
depends_on = [module.resource_group, module.vnet, data.azurerm_resource_group.main]
source = "../.."
name = "app"
environment = "test2"
label_order = ["name", "environment"]
main_rg_name = data.azurerm_resource_group.main.name
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
virtual_network_id = module.vnet.vnet_id[0]
delegated_subnet_id = module.subnet.default_subnet_id[0]
postgresql_version = "12"
zone = "1"
admin_username = "postgresqlusern"
admin_password = "ba5yatgfgfhdsvvc6A3ns2lu4gqzzc"
tier = "Burstable"
size = "B1ms"
database_names = ["maindb"]
charset = "utf8"
collation = "en_US.utf8"
existing_private_dns_zone = true
existing_private_dns_zone_id = data.azurerm_private_dns_zone.main.id
existing_private_dns_zone_name = data.azurerm_private_dns_zone.main.name
}
```