-
Notifications
You must be signed in to change notification settings - Fork 17
/
main.tf
86 lines (69 loc) · 1.96 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
variable "static_web_app_name" {
type = string
description = "The name of the static web app resource."
}
variable "web_app_name" {
type = string
description = "The name of the web app resource."
}
# Configure the Azure provider
terraform {
backend "azurerm" {
resource_group_name = "GitHub"
storage_account_name = "austengithubstorage"
container_name = "tfstate"
key = "prod.terraform.tfstate2"
}
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.0.2"
}
}
required_version = ">= 1.1.0"
}
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "GitHub" {
location = "eastus2"
name = format("GitHub-%s", var.web_app_name)
}
// Web App
resource "azurerm_service_plan" "example" {
name = "example-plan"
resource_group_name = azurerm_resource_group.GitHub.name
location = azurerm_resource_group.GitHub.location
os_type = "Linux"
sku_name = "P1v2"
}
resource "azurerm_linux_web_app" "example" {
name = var.web_app_name
resource_group_name = azurerm_resource_group.GitHub.name
location = azurerm_resource_group.GitHub.location
service_plan_id = azurerm_service_plan.example.id
site_config {}
}
resource "azurerm_linux_web_app_slot" "example" {
name = format("%s-slot", var.web_app_name)
app_service_id = azurerm_linux_web_app.example.id
site_config {}
}
// Static Site
resource "azurerm_static_site" "web" {
name = var.static_web_app_name
location = azurerm_resource_group.GitHub.location
resource_group_name = azurerm_resource_group.GitHub.name
}
output "name" {
value = azurerm_static_site.web.name
}
output "url" {
value = azurerm_static_site.web.default_host_name
}
output "api_key" {
value = azurerm_static_site.web.api_key
}
output "app_name" {
value = azurerm_linux_web_app.example.name
}