Skip to content

Commit 693c743

Browse files
authored
Merge pull request #1 from kumarvna/develop
final configuration for version 1.0
2 parents 2b49146 + 3837891 commit 693c743

File tree

15 files changed

+1283
-1
lines changed

15 files changed

+1283
-1
lines changed

README.md

Lines changed: 240 additions & 1 deletion
Large diffs are not rendered by default.

examples/MariaDB_Server/README.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Azure Database for MariaDB Terraform Module
2+
3+
Azure Database for MariaDB is a relational database service based on the open-source MariaDB Server engine. It's a fully managed database as a service offering that can handle mission-critical workloads with predictable performance and dynamic scalability.
4+
5+
## Module Usage
6+
7+
```terraform
8+
module "mariadb" {
9+
source = "kumarvna/mariadb-server/azurerm"
10+
version = "1.0.0"
11+
12+
# By default, this module will create a resource group
13+
# proivde a name to use an existing resource group and set the argument
14+
# to `create_resource_group = false` if you want to existing resoruce group.
15+
# If you use existing resrouce group location will be the same as existing RG.
16+
create_resource_group = false
17+
resource_group_name = "rg-shared-westeurope-01"
18+
location = "westeurope"
19+
20+
# MariaDB Server and Database settings
21+
mariadb_server_name = "mariadbsqlsrv01"
22+
23+
mariadb_settings = {
24+
sku_name = "GP_Gen5_16"
25+
storage_mb = 5120
26+
version = "10.2"
27+
# default admin user `sqladmin` and can be specified as per the choice here
28+
# by default random password created by this module. required password can be specified here
29+
admin_username = "sqladmin"
30+
admin_password = "H@Sh1CoR3!"
31+
# Database name, charset and collection arguments
32+
database_name = "demomariadb01"
33+
charset = "utf8"
34+
collation = "utf8_unicode_ci"
35+
# Storage Profile and other optional arguments
36+
auto_grow_enabled = true
37+
backup_retention_days = 7
38+
geo_redundant_backup_enabled = false
39+
public_network_access_enabled = true
40+
ssl_enforcement_enabled = true
41+
}
42+
43+
# Sets a MariaDB Configuration value on a MariaDB Server.
44+
# For more information: https://mariadb.com/kb/en/server-system-variables/
45+
mariadb_configuration = {
46+
interactive_timeout = "600"
47+
}
48+
49+
# Use Virtual Network service endpoints and rules for Azure Database for MariaDB
50+
subnet_id = var.subnet_id
51+
52+
# (Optional) To enable Azure Monitoring for Azure MariaDB database
53+
# (Optional) Specify `enable_logs_to_storage_account` to save monitoring logs to storage.
54+
# Create required storage account by specifying optional `storage_account_name` variable.
55+
log_analytics_workspace_name = "loganalytics-we-sharedtest2"
56+
enable_logs_to_storage_account = true
57+
storage_account_name = "mariadblogdignostics"
58+
59+
# Firewall Rules to allow azure and external clients and specific Ip address/ranges.
60+
firewall_rules = {
61+
access-to-azure = {
62+
start_ip_address = "0.0.0.0"
63+
end_ip_address = "0.0.0.0"
64+
},
65+
desktop-ip = {
66+
start_ip_address = "49.204.228.223"
67+
end_ip_address = "49.204.228.223"
68+
}
69+
}
70+
71+
# Tags for Azure Resources
72+
tags = {
73+
Terraform = "true"
74+
Environment = "dev"
75+
Owner = "test-user"
76+
}
77+
}
78+
```
79+
80+
## Terraform Usage
81+
82+
To run this example you need to execute following Terraform commands
83+
84+
```hcl
85+
terraform init
86+
87+
terraform plan
88+
89+
terraform apply
90+
```
91+
92+
Run `terraform destroy` when you don't need these resources.

examples/MariaDB_Server/main.tf

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
module "mariadb" {
2+
source = "kumarvna/mariadb-server/azurerm"
3+
version = "1.0.0"
4+
5+
# By default, this module will create a resource group
6+
# proivde a name to use an existing resource group and set the argument
7+
# to `create_resource_group = false` if you want to existing resoruce group.
8+
# If you use existing resrouce group location will be the same as existing RG.
9+
create_resource_group = false
10+
resource_group_name = "rg-shared-westeurope-01"
11+
location = "westeurope"
12+
13+
# MariaDB Server and Database settings
14+
mariadb_server_name = "mariadbsqlsrv01"
15+
16+
mariadb_settings = {
17+
sku_name = "GP_Gen5_16"
18+
storage_mb = 5120
19+
version = "10.2"
20+
# default admin user `sqladmin` and can be specified as per the choice here
21+
# by default random password created by this module. required password can be specified here
22+
admin_username = "sqladmin"
23+
admin_password = "H@Sh1CoR3!"
24+
# Database name, charset and collection arguments
25+
database_name = "demomariadb01"
26+
charset = "utf8"
27+
collation = "utf8_unicode_ci"
28+
# Storage Profile and other optional arguments
29+
auto_grow_enabled = true
30+
backup_retention_days = 7
31+
geo_redundant_backup_enabled = false
32+
public_network_access_enabled = true
33+
ssl_enforcement_enabled = true
34+
}
35+
36+
# Sets a MariaDB Configuration value on a MariaDB Server.
37+
# For more information: https://mariadb.com/kb/en/server-system-variables/
38+
mariadb_configuration = {
39+
interactive_timeout = "600"
40+
}
41+
42+
# Use Virtual Network service endpoints and rules for Azure Database for MariaDB
43+
subnet_id = var.subnet_id
44+
45+
# (Optional) To enable Azure Monitoring for Azure MariaDB database
46+
# (Optional) Specify `enable_logs_to_storage_account` to save monitoring logs to storage.
47+
# Create required storage account by specifying optional `storage_account_name` variable.
48+
log_analytics_workspace_name = "loganalytics-we-sharedtest2"
49+
enable_logs_to_storage_account = true
50+
storage_account_name = "mariadblogdignostics"
51+
52+
# Firewall Rules to allow azure and external clients and specific Ip address/ranges.
53+
firewall_rules = {
54+
access-to-azure = {
55+
start_ip_address = "0.0.0.0"
56+
end_ip_address = "0.0.0.0"
57+
},
58+
desktop-ip = {
59+
start_ip_address = "49.204.228.223"
60+
end_ip_address = "49.204.228.223"
61+
}
62+
}
63+
64+
# Tags for Azure Resources
65+
tags = {
66+
Terraform = "true"
67+
Environment = "dev"
68+
Owner = "test-user"
69+
}
70+
}

examples/MariaDB_Server/output.tf

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
output "resource_group_name" {
2+
description = "The name of the resource group in which resources are created"
3+
value = module.mariadb.resource_group_name
4+
}
5+
6+
output "resource_group_location" {
7+
description = "The location of the resource group in which resources are created"
8+
value = module.mariadb.resource_group_location
9+
}
10+
11+
output "storage_account_id" {
12+
description = "The ID of the storage account"
13+
value = module.mariadb.storage_account_id
14+
}
15+
16+
output "storage_account_name" {
17+
description = "The name of the storage account"
18+
value = module.mariadb.storage_account_name
19+
}
20+
21+
output "mariadb_server_id" {
22+
description = "The resource ID of the MariaDB Server"
23+
value = module.mariadb.mariadb_server_id
24+
}
25+
26+
output "mariadb_server_fqdn" {
27+
description = "The FQDN of the MariaDB Server"
28+
value = module.mariadb.mariadb_server_fqdn
29+
}
30+
31+
output "mariadb_database_id" {
32+
description = "The resource ID of the MariaDB Database"
33+
value = module.mariadb.mariadb_database_id
34+
}
35+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
variable "subnet_id" {
2+
description = "The resource ID of the subnet"
3+
default = null
4+
}

examples/README.md

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# Azure Database for MariaDB Terraform Module
2+
3+
Azure Database for MariaDB is a relational database service based on the open-source MariaDB Server engine. It's a fully managed database as a service offering that can handle mission-critical workloads with predictable performance and dynamic scalability.
4+
5+
## Module Usage (MariaDB with optional resources)
6+
7+
```terraform
8+
module "mariadb" {
9+
source = "kumarvna/mariadb-server/azurerm"
10+
version = "1.0.0"
11+
12+
# By default, this module will create a resource group
13+
# proivde a name to use an existing resource group and set the argument
14+
# to `create_resource_group = false` if you want to existing resoruce group.
15+
# If you use existing resrouce group location will be the same as existing RG.
16+
create_resource_group = false
17+
resource_group_name = "rg-shared-westeurope-01"
18+
location = "westeurope"
19+
20+
# MariaDB Server and Database settings
21+
mariadb_server_name = "mariadbsqlsrv01"
22+
23+
mariadb_settings = {
24+
sku_name = "GP_Gen5_16"
25+
storage_mb = 5120
26+
version = "10.2"
27+
# default admin user `sqladmin` and can be specified as per the choice here
28+
# by default random password created by this module. required password can be specified here
29+
admin_username = "sqladmin"
30+
admin_password = "H@Sh1CoR3!"
31+
# Database name, charset and collection arguments
32+
database_name = "demomariadb01"
33+
charset = "utf8"
34+
collation = "utf8_unicode_ci"
35+
# Storage Profile and other optional arguments
36+
auto_grow_enabled = true
37+
backup_retention_days = 7
38+
geo_redundant_backup_enabled = false
39+
public_network_access_enabled = true
40+
ssl_enforcement_enabled = true
41+
}
42+
43+
# Sets a MariaDB Configuration value on a MariaDB Server.
44+
# For more information: https://mariadb.com/kb/en/server-system-variables/
45+
mariadb_configuration = {
46+
interactive_timeout = "600"
47+
}
48+
49+
# Use Virtual Network service endpoints and rules for Azure Database for MariaDB
50+
subnet_id = var.subnet_id
51+
52+
# (Optional) To enable Azure Monitoring for Azure MariaDB database
53+
# (Optional) Specify `enable_logs_to_storage_account` to save monitoring logs to storage.
54+
# Create required storage account by specifying optional `storage_account_name` variable.
55+
log_analytics_workspace_name = "loganalytics-we-sharedtest2"
56+
enable_logs_to_storage_account = true
57+
storage_account_name = "mariadblogdignostics"
58+
59+
# Firewall Rules to allow azure and external clients and specific Ip address/ranges.
60+
firewall_rules = {
61+
access-to-azure = {
62+
start_ip_address = "0.0.0.0"
63+
end_ip_address = "0.0.0.0"
64+
},
65+
desktop-ip = {
66+
start_ip_address = "49.204.228.223"
67+
end_ip_address = "49.204.228.223"
68+
}
69+
}
70+
71+
# Tags for Azure Resources
72+
tags = {
73+
Terraform = "true"
74+
Environment = "dev"
75+
Owner = "test-user"
76+
}
77+
}
78+
```
79+
80+
## Module Usage (MariaDB with Private Endpoint and other optional resources)
81+
82+
```hcl
83+
module "mariadb" {
84+
source = "kumarvna/mariadb-server/azurerm"
85+
version = "1.0.0"
86+
87+
# By default, this module will create a resource group
88+
# proivde a name to use an existing resource group and set the argument
89+
# to `create_resource_group = false` if you want to existing resoruce group.
90+
# If you use existing resrouce group location will be the same as existing RG.
91+
create_resource_group = false
92+
resource_group_name = "rg-shared-westeurope-01"
93+
location = "westeurope"
94+
95+
# MariaDB Server and Database settings
96+
mariadb_server_name = "mariadbsqlsrv01"
97+
98+
mariadb_settings = {
99+
sku_name = "GP_Gen5_16"
100+
storage_mb = 5120
101+
version = "10.2"
102+
# default admin user `sqladmin` and can be specified as per the choice here
103+
# by default random password created by this module. required password can be specified here
104+
admin_username = "sqladmin"
105+
admin_password = "H@Sh1CoR3!"
106+
# Database name, charset and collection arguments
107+
database_name = "demomariadb01"
108+
charset = "utf8"
109+
collation = "utf8_unicode_ci"
110+
# Storage Profile and other optional arguments
111+
auto_grow_enabled = true
112+
backup_retention_days = 7
113+
geo_redundant_backup_enabled = false
114+
public_network_access_enabled = true
115+
ssl_enforcement_enabled = true
116+
}
117+
118+
# Sets a MariaDB Configuration value on a MariaDB Server.
119+
# For more information: https://mariadb.com/kb/en/server-system-variables/
120+
mariadb_configuration = {
121+
interactive_timeout = "600"
122+
}
123+
124+
# Use Virtual Network service endpoints and rules for Azure Database for MariaDB
125+
subnet_id = var.subnet_id
126+
127+
# (Optional) To enable Azure Monitoring for Azure MariaDB database
128+
# (Optional) Specify `enable_logs_to_storage_account` to save monitoring logs to storage.
129+
# Create required storage account by specifying optional `storage_account_name` variable.
130+
log_analytics_workspace_name = "loganalytics-we-sharedtest2"
131+
enable_logs_to_storage_account = true
132+
storage_account_name = "mariadblogdignostics"
133+
134+
# Creating Private Endpoint requires, VNet name and address prefix to create a subnet
135+
# By default this will create a `privatelink.mysql.database.azure.com` DNS zone.
136+
# To use existing private DNS zone specify `existing_private_dns_zone` with valid zone name
137+
enable_private_endpoint = true
138+
virtual_network_name = "vnet-shared-hub-westeurope-001"
139+
private_subnet_address_prefix = ["10.1.5.0/29"]
140+
# existing_private_dns_zone = "demo.example.com"
141+
142+
# Firewall Rules to allow azure and external clients and specific Ip address/ranges.
143+
firewall_rules = {
144+
access-to-azure = {
145+
start_ip_address = "0.0.0.0"
146+
end_ip_address = "0.0.0.0"
147+
},
148+
desktop-ip = {
149+
start_ip_address = "49.204.228.223"
150+
end_ip_address = "49.204.228.223"
151+
}
152+
}
153+
154+
# Tags for Azure Resources
155+
tags = {
156+
Terraform = "true"
157+
Environment = "dev"
158+
Owner = "test-user"
159+
}
160+
}
161+
```
162+
163+
## Terraform Usage
164+
165+
To run this example you need to execute following Terraform commands
166+
167+
```hcl
168+
terraform init
169+
170+
terraform plan
171+
172+
terraform apply
173+
```
174+
175+
Run `terraform destroy` when you don't need these resources.

0 commit comments

Comments
 (0)