-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
109 lines (90 loc) · 2.71 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=3.0.0"
}
}
}
# Configure the Microsoft Azure Provider
provider "azurerm" {
features {}
}
terraform {
backend "azurerm" {
resource_group_name = "cloud-shell-storage-centralindia"
storage_account_name = "csg10032002176a1b4f"
container_name = "tfstate"
key = "terraform.tfstate"
}
}
# Create a resource group
resource "azurerm_resource_group" "rg" {
name = "${var.rgname}"
location = "${var.rglocation}"
}
resource "azurerm_virtual_network" "sc_vnet1" {
name = "sc_vnet"
address_space = ["192.168.0.0/16"]
location = "${var.rglocation}"
resource_group_name = "${var.rgname}"
}
resource "azurerm_subnet" "sc_bastion_subnet" {
name = "${var.azure_bastion_subnet}"
resource_group_name = "${var.rgname}"
virtual_network_name = azurerm_virtual_network.sc_vnet1.name
address_prefixes = ["192.168.1.224/27"]
}
resource "azurerm_public_ip" "sc_pip" {
name = "${var.sc_pip}"
location = "${var.rglocation}"
resource_group_name = "${var.rgname}"
allocation_method = "Static"
sku = "Standard"
}
resource "azurerm_bastion_host" "bastion_host" {
name = "${var.sc_bastion_host}"
location = "${var.rglocation}"
resource_group_name = "${var.rgname}"
ip_configuration {
name = "configuration"
subnet_id = azurerm_subnet.sc_bastion_subnet.id
public_ip_address_id = azurerm_public_ip.sc_pip.id
}
}
resource "azurerm_application_insights" "sc_app_insights" {
name = "${var.app_insights_name}"
location = "${var.rglocation}"
resource_group_name = "${var.rgname}"
application_type = "web"
}
resource "azurerm_monitor_diagnostic_setting" "diag" {
name = "monitoring"
target_resource_id = azurerm_spring_cloud_service.sc.id
log_analytics_workspace_id = azurerm_log_analytics_workspace.sc_law.id
log {
category = "ApplicationConsole"
enabled = true
retention_policy {
enabled = false
}
}
metric {
category = "AllMetrics"
retention_policy {
enabled = false
}
}
}
resource "azurerm_log_analytics_workspace" "sc_law" {
name = "${var.law_name}"
location = "${var.rglocation}"
resource_group_name = "${var.rgname}"
sku = "PerGB2018"
retention_in_days = 30
}
resource "azurerm_spring_cloud_service" "sc" {
name = "${var.sc_service_name}"
resource_group_name = "${var.rgname}"
location = "${var.rglocation}"
}