-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
90 lines (75 loc) · 2.34 KB
/
Copy pathmain.tf
File metadata and controls
90 lines (75 loc) · 2.34 KB
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
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.8"
}
}
backend "azurerm" {
resource_group_name = "cohort32-33_AleYip_ProjectExercise"
storage_account_name = "m12tfstore"
container_name = "m12-tf-store-container"
key = "terraform.tfstate"
}
}
provider "azurerm" {
features {}
subscription_id = "d33b95c7-af3c-4247-9661-aa96d47fccc0"
}
data "azurerm_resource_group" "main" {
name = "cohort32-33_AleYip_ProjectExercise"
}
resource "azurerm_service_plan" "main" {
name = "${var.prefix}-terraformed-asp"
location = data.azurerm_resource_group.main.location
resource_group_name = data.azurerm_resource_group.main.name
os_type = "Linux"
sku_name = "B1"
}
resource "azurerm_linux_web_app" "main" {
name = "${var.prefix}-aleyipsoftwire-m12-exercise"
location = data.azurerm_resource_group.main.location
resource_group_name = data.azurerm_resource_group.main.name
service_plan_id = azurerm_service_plan.main.id
site_config {
application_stack {
docker_image_name = "aleyipsoftwire/todo-app:prod"
docker_registry_url = "https://docker.io"
}
}
app_settings = {
WEBSITES_PORT = 8000
MONGODB_PRIMARY_CONNECTION_STRING = azurerm_cosmosdb_account.main.primary_mongodb_connection_string
}
}
resource "azurerm_cosmosdb_account" "main" {
name = "${var.prefix}-aleyipsoftwire-m12-mongodb-cluster"
location = data.azurerm_resource_group.main.location
resource_group_name = data.azurerm_resource_group.main.name
offer_type = "Standard"
kind = "MongoDB"
automatic_failover_enabled = true
capabilities {
name = "EnableMongo"
}
capabilities {
name = "EnableServerless"
}
consistency_policy {
consistency_level = "BoundedStaleness"
max_interval_in_seconds = 300
max_staleness_prefix = 100000
}
geo_location {
location = "uksouth"
failover_priority = 0
}
lifecycle {
prevent_destroy = true
}
}
resource "azurerm_cosmosdb_mongo_database" "main" {
name = "todo-app-db"
resource_group_name = data.azurerm_resource_group.main.name
account_name = azurerm_cosmosdb_account.main.name
}