-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
80 lines (68 loc) · 2.23 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
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.11.0"
}
azurecaf = {
source = "aztfmod/azurecaf"
version = "1.2.16"
}
}
}
provider "azurerm" {
features {}
}
locals {
environment = var.environment == "" ? "dev" : var.environment
}
resource "azurecaf_name" "resource_group" {
name = var.application_name
resource_type = "azurerm_resource_group"
suffixes = [local.environment]
}
resource "azurerm_resource_group" "main" {
name = azurecaf_name.resource_group.result
location = var.location
tags = {
"terraform" = "true"
"environment" = local.environment
"application-name" = var.application_name
"nubesgen-version" = "0.13.0"
}
}
module "application" {
source = "./modules/spring-cloud"
resource_group = azurerm_resource_group.main.name
application_name = var.application_name
environment = local.environment
location = var.location
database_url = module.database.database_url
database_username = module.database.database_username
database_password = module.database.database_password
azure_application_insights_connection_string = module.application-insights.azure_application_insights_connection_string
azure_storage_account_name = module.storage-blob.azurerm_storage_account_name
azure_storage_blob_endpoint = module.storage-blob.azurerm_storage_blob_endpoint
azure_storage_account_key = module.storage-blob.azurerm_storage_account_key
}
module "database" {
source = "./modules/mysql"
resource_group = azurerm_resource_group.main.name
application_name = var.application_name
environment = local.environment
location = var.location
}
module "application-insights" {
source = "./modules/application-insights"
resource_group = azurerm_resource_group.main.name
application_name = var.application_name
environment = local.environment
location = var.location
}
module "storage-blob" {
source = "./modules/storage-blob"
resource_group = azurerm_resource_group.main.name
application_name = var.application_name
environment = local.environment
location = var.location
}