forked from krishcool/test1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sql server
64 lines (56 loc) · 1.65 KB
/
sql server
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
# Set the Azure Provider source and version being used
terraform {
required_version = ">= 0.14"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.1.0"
}
}
}
# Configure the Microsoft Azure provider
provider "azurerm" {
features {}
}
terraform {
backend "azurerm" {
resource_group_name = "rgteswesteu001"
storage_account_name = "strgtestwesteu001"
container_name = "conttesywesteu001"
key = "terraform.tfstate"
}
}
# create Resource Group
data "azurerm_resource_group" "resourcegroup" {
name = "rgteswesteu001"
}
# create sql server
resource "azurerm_sql_server" "test" {
name = "sqltestwesteu001"
resource_group_name = "rgtestwesteu009"
location = "West Europe"
version = "12.0"
administrator_login = "adm1234"
administrator_login_password = "Adm@123456789"
tags = {
environment = "test"
}
}
#create storage account
resource "azurerm_storage_account" "test" {
name = "strgtestwesteu009"
resource_group_name = "rgtestwesteu001"
location = "West Europe"
account_tier = "Standard"
account_replication_type = "LRS"
}
#create sql database
resource "azurerm_sql_database" "test" {
name = "sqldbtestwesteu009"
resource_group_name = "rgtestwesteu001"
location = "West Europe"
server_name = azurerm_sql_server.test.name
tags = {
environment = "test"
}
}