-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.tf
90 lines (77 loc) · 1.62 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
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
provider "azurerm" {
features {}
}
# Variables
variable "location" {
type = string
}
variable "rgName" {
type = string
}
variable "name" {
type = string
}
variable "planId" {
type = string
}
variable "offerId" {
type = string
}
variable "publisherId" {
type = string
}
variable "quantity" {
type = number
}
variable "termId" {
type = string
}
variable "azureSubscriptionId" {
type = string
}
variable "publisherTestEnvironment" {
type = string
default = ""
}
variable "autoRenew" {
type = bool
}
# Create a resource group if it doesn't exist
resource "azurerm_resource_group" "myterraformgroup" {
name = var.rgName
location = var.location
}
# Create ARM template deployment
resource "azurerm_resource_group_template_deployment" "arm_template" {
name = "terraform_arm_template"
resource_group_name = azurerm_resource_group.myterraformgroup.name
deployment_mode = "Incremental"
parameters_content = jsonencode({
"name" = {
value = var.name
},
"publisherId" = {
value = var.publisherId
},
"offerId" = {
value = var.offerId
},
"planId" = {
value = var.planId
},
"termId" = {
value = var.termId
},
"quantity" = {
value = var.quantity
},
"azureSubscriptionId" = {
value = var.azureSubscriptionId
},
"autoRenew" = {
value = var.autoRenew
}
})
// Source ARM template from file in another folder
template_content = file("../saas-arm/saas-arm.json")
}