Skip to content

Commit 4fc28f1

Browse files
committed
update examples
1 parent ce8f556 commit 4fc28f1

File tree

4 files changed

+282
-0
lines changed
  • examples
    • SQL_DB_Using_Geo-replication_with_Auto-Failover_Groups_and_Private_Endpoints
    • SQL_DB_Using_Geo-replication_with_Auto-Failover_Groups
    • Simple_SQL_Single_Database_Using_Private_Endpoint
    • Simple_SQL_Single_Database_creation

4 files changed

+282
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Azure SQL Database Using Failover Groups with Private endpoints
2+
3+
Terraform module for Azure to create a SQL server with initial database, Azure AD login, Firewall rules for SQL, Failover Group, Private endpoint, and corresponding private DNS zone for privatelink A records. It also allows creating an SQL server database with a SQL script initialization.
4+
5+
## Module Usage
6+
7+
### Azure SQL database creation using geo-replication with auto-failover groups
8+
9+
Following example to create a SQL database using geo-replication with auto-failover groups. This module also supports optional AD admin user for DB, Audit Policies, Firewall Rules, and creation of database schema using SQL script.
10+
11+
```
12+
module "mssql-server" {
13+
source = "kumarvna/mssql-db/azurerm"
14+
version = "1.0.0"
15+
16+
# Resource Group, VNet and Subnet declarations
17+
create_resource_group = false
18+
resource_group_name = "rg-demo-westeurope-01"
19+
location = "westeurope"
20+
virtual_network_name = "vnet-demo-westeurope-001"
21+
private_subnet_address_prefix = "10.0.5.0/29"
22+
23+
# SQL Server and Database scaling options
24+
sqlserver_name = "sqldbserver-db01"
25+
database_name = "demomssqldb"
26+
sql_database_edition = "Standard"
27+
sqldb_service_objective_name = "S1"
28+
29+
# SQL Server and Database Audit policies
30+
enable_auditing_policy = true
31+
enable_threat_detection_policy = true
32+
log_retention_days = 30
33+
email_addresses_for_alerts = ["[email protected]"]
34+
35+
# AD administrator for an Azure SQL server
36+
enable_sql_ad_admin = true
37+
ad_admin_login_name = "[email protected]"
38+
39+
# Firewall Rules to allow azure and external clients
40+
enable_firewall_rules = true
41+
firewall_rules = [
42+
{name = "access-to-azure"
43+
start_ip_address = "0.0.0.0"
44+
end_ip_address = "0.0.0.0"},
45+
{name = "desktop-ip"
46+
start_ip_address = "123.201.75.71"
47+
end_ip_address = "123.201.75.71"}]
48+
49+
# Sql failover group
50+
enable_failover_group = true
51+
secondary_sql_server_location = "northeurope"
52+
53+
# Create and initialize a database with SQL script
54+
initialize_sql_script_execution = false
55+
sqldb_init_script_file = "./artifacts/db-init-sample.sql"
56+
57+
# Tags for Azure Resources
58+
tags = {
59+
Terraform = "true"
60+
Environment = "dev"
61+
Owner = "test-user"
62+
}
63+
}
64+
```
65+
66+
## Terraform Usage
67+
68+
To run this example you need to execute following Terraform commands
69+
70+
```
71+
$ terraform init
72+
$ terraform plan
73+
$ terraform apply
74+
```
75+
76+
Run `terraform destroy` when you don't need these resources.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Azure SQL Database Using Failover Groups with Private endpoints
2+
3+
Terraform module for Azure to create a SQL server with initial database, Azure AD login, Firewall rules for SQL, Failover Group, Private endpoint, and corresponding private DNS zone for privatelink A records. It also allows creating an SQL server database with a SQL script initialization.
4+
5+
## Module Usage
6+
7+
### Azure SQL database creation using geo-replication with auto-failover groups and Private Endpoints
8+
9+
Following example to create a SQL database using geo-replication with auto-failover groups and private endpoints. This module also supports optional AD admin user for DB, Audit Policies, Firewall Rules, and creation of database schema using SQL script.
10+
11+
```
12+
module "mssql-server" {
13+
source = "kumarvna/mssql-db/azurerm"
14+
version = "1.0.0"
15+
16+
# Resource Group, VNet and Subnet declarations
17+
create_resource_group = false
18+
resource_group_name = "rg-demo-westeurope-01"
19+
location = "westeurope"
20+
virtual_network_name = "vnet-demo-westeurope-001"
21+
private_subnet_address_prefix = "10.0.5.0/29"
22+
23+
# SQL Server and Database scaling options
24+
sqlserver_name = "sqldbserver-db01"
25+
database_name = "demomssqldb"
26+
sql_database_edition = "Standard"
27+
sqldb_service_objective_name = "S1"
28+
29+
# SQL Server and Database Audit policies
30+
enable_auditing_policy = true
31+
enable_threat_detection_policy = true
32+
log_retention_days = 30
33+
email_addresses_for_alerts = ["[email protected]"]
34+
35+
# AD administrator for an Azure SQL server
36+
enable_sql_ad_admin = true
37+
ad_admin_login_name = "[email protected]"
38+
39+
# Sql failover group
40+
enable_failover_group = true
41+
secondary_sql_server_location = "northeurope"
42+
43+
# Private Endpoint for Sql servers
44+
enable_private_endpoint = true
45+
46+
# Create and initialize a database with SQL script
47+
initialize_sql_script_execution = false
48+
sqldb_init_script_file = "./artifacts/db-init-sample.sql"
49+
50+
# Tags for Azure Resources
51+
tags = {
52+
Terraform = "true"
53+
Environment = "dev"
54+
Owner = "test-user"
55+
}
56+
}
57+
```
58+
59+
## Terraform Usage
60+
61+
To run this example you need to execute following Terraform commands
62+
63+
```
64+
$ terraform init
65+
$ terraform plan
66+
$ terraform apply
67+
```
68+
69+
Run `terraform destroy` when you don't need these resources.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Azure SQL Database Using Failover Groups with Private endpoints
2+
3+
Terraform module for Azure to create a SQL server with initial database, Azure AD login, Firewall rules for SQL, Failover Group, Private endpoint, and corresponding private DNS zone for privatelink A records. It also allows creating an SQL server database with a SQL script initialization.
4+
5+
## Module Usage
6+
7+
### Simple Azure SQL single database using private Endpoint
8+
9+
Following example to create a SQL single database using private endpoints. This module also supports optional AD admin user for DB, Audit Policies, and creation of database schema using SQL script.
10+
11+
```
12+
module "mssql-server" {
13+
source = "kumarvna/mssql-db/azurerm"
14+
version = "1.0.0"
15+
16+
# Resource Group, VNet and Subnet declarations
17+
create_resource_group = false
18+
resource_group_name = "rg-demo-westeurope-01"
19+
location = "westeurope"
20+
virtual_network_name = "vnet-demo-westeurope-001"
21+
private_subnet_address_prefix = "10.0.5.0/29"
22+
23+
# SQL Server and Database scaling options
24+
sqlserver_name = "sqldbserver-db01"
25+
database_name = "demomssqldb"
26+
sql_database_edition = "Standard"
27+
sqldb_service_objective_name = "S1"
28+
29+
# SQL Server and Database Audit policies
30+
enable_auditing_policy = true
31+
enable_threat_detection_policy = true
32+
log_retention_days = 30
33+
email_addresses_for_alerts = ["[email protected]"]
34+
35+
# AD administrator for an Azure SQL server
36+
enable_sql_ad_admin = true
37+
ad_admin_login_name = "[email protected]"
38+
39+
# Private Endpoint for Sql servers
40+
enable_private_endpoint = true
41+
42+
# Create and initialize a database with SQL script
43+
initialize_sql_script_execution = false
44+
sqldb_init_script_file = "./artifacts/db-init-sample.sql"
45+
46+
# Tags for Azure Resources
47+
tags = {
48+
Terraform = "true"
49+
Environment = "dev"
50+
Owner = "test-user"
51+
}
52+
}
53+
```
54+
55+
## Terraform Usage
56+
57+
To run this example you need to execute following Terraform commands
58+
59+
```
60+
$ terraform init
61+
$ terraform plan
62+
$ terraform apply
63+
```
64+
65+
Run `terraform destroy` when you don't need these resources.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Azure SQL Database Using Failover Groups with Private endpoints
2+
3+
Terraform module for Azure to create a SQL server with initial database, Azure AD login, Firewall rules for SQL, Failover Group, Private endpoint, and corresponding private DNS zone for privatelink A records. It also allows creating an SQL server database with a SQL script initialization.
4+
5+
## Module Usage
6+
7+
### Simple Azure SQL single database creation
8+
9+
Following example is to create a simple database with basic firewall rules to make SQL database available to Azure resources, services and client IP ranges. This module also supports optional AD admin user for DB, Audit Polices, and creation of database schema using SQL script.
10+
11+
```
12+
module "mssql-server" {
13+
source = "kumarvna/mssql-db/azurerm"
14+
version = "1.0.0"
15+
16+
# Resource Group, VNet and Subnet declarations
17+
create_resource_group = false
18+
resource_group_name = "rg-demo-westeurope-01"
19+
location = "westeurope"
20+
virtual_network_name = "vnet-demo-westeurope-001"
21+
private_subnet_address_prefix = "10.0.5.0/29"
22+
23+
# SQL Server and Database scaling options
24+
sqlserver_name = "sqldbserver-db01"
25+
database_name = "demomssqldb"
26+
sql_database_edition = "Standard"
27+
sqldb_service_objective_name = "S1"
28+
29+
# SQL Server and Database Audit policies
30+
enable_auditing_policy = true
31+
enable_threat_detection_policy = true
32+
log_retention_days = 30
33+
email_addresses_for_alerts = ["[email protected]"]
34+
35+
# AD administrator for an Azure SQL server
36+
enable_sql_ad_admin = true
37+
ad_admin_login_name = "[email protected]"
38+
39+
# Firewall Rules to allow azure and external clients
40+
enable_firewall_rules = true
41+
firewall_rules = [
42+
{name = "access-to-azure"
43+
start_ip_address = "0.0.0.0"
44+
end_ip_address = "0.0.0.0"},
45+
{name = "desktop-ip"
46+
start_ip_address = "123.201.75.71"
47+
end_ip_address = "123.201.75.71"}]
48+
49+
# Create and initialize a database with SQL script
50+
initialize_sql_script_execution = false
51+
sqldb_init_script_file = "./artifacts/db-init-sample.sql"
52+
53+
# Tags for Azure Resources
54+
tags = {
55+
Terraform = "true"
56+
Environment = "dev"
57+
Owner = "test-user"
58+
}
59+
}
60+
```
61+
62+
## Terraform Usage
63+
64+
To run this example you need to execute following Terraform commands
65+
66+
```
67+
$ terraform init
68+
$ terraform plan
69+
$ terraform apply
70+
```
71+
72+
Run `terraform destroy` when you don't need these resources.

0 commit comments

Comments
 (0)