-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
64 lines (58 loc) · 1.69 KB
/
main.tf
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
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.15.1"
}
}
}
provider "azurerm" {
features {}
}
# dynamic resource group
resource "azurerm_resource_group" "main" {
name = var.resource_group_name # set the name as variable
location = var.resource_group_location
tags = {
environment = var.environment
}
}
# dynamic app service plan
resource "azurerm_app_service_plan" "main" {
name = var.app_service_plan_name
location = azurerm_resource_group.main.location
resource_group_name = azurerm_resource_group.main.name
# get the resource group output name and location and assigned
sku {
tier = "Standard"
size = "S1"
}
}
# dynamic app service
resource "azurerm_app_service" "main" {
name = var.app_service_name
location = azurerm_resource_group.main.location
resource_group_name = azurerm_resource_group.main.name
app_service_plan_id = azurerm_app_service_plan.main.id
}
# dynamic mssql server
resource "azurerm_mssql_server" "main" {
name = var.mssql_server_name
resource_group_name = azurerm_resource_group.main.name
location = azurerm_resource_group.main.location
version = "12.0"
administrator_login = var.mssql_server_username
administrator_login_password = var.mssql_server_password
tags = {
environment = var.environment
}
}
# dynamic mssql
resource "azurerm_mssql_database" "main" {
name = var.mssql_database_name
server_id = azurerm_mssql_server.main.id
license_type = "LicenseIncluded"
tags = {
environment = var.environment
}
}