-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
50 lines (41 loc) · 1.49 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
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.29.1"
configuration_aliases = [azurerm, azurerm.management, azurerm.connectivity]
}
azurecaf = {
source = "aztfmod/azurecaf"
version = "2.0.0-preview3"
}
random = {
source = "hashicorp/random"
version = "3.4.3"
}
}
}
locals {
# Get subscription data
subs_platform_mgmt_id = var.config.subscriptions.platform.conn.id
subs_landing_zones_corp_id = [for sub in var.config.subscriptions.landing_zones.corp.subscriptions : sub.id]
subs_landing_zones_corp_name = [for sub in var.config.subscriptions.landing_zones.corp.subscriptions : sub.name]
rsg_dns_name = "${var.config.generic.org.root_id}-dns"
# Get the OS Type shortname
os_type_short = var.os_type != "linux" ? "win" : "lin"
# Set bools for validation
is_linux = var.os_type == "linux" ? true : false
is_windows = var.os_type == "windows" ? true : false
is_windows_server = var.os_type == "windows_server" ? true : false
is_windows_or_windows_server = local.is_windows || local.is_windows_server ? true : false
# Tags
tags = merge(var.tags, {
terraformWorkspace = "compute/virtual_machine"
vmBackupEnabled = var.disable_backup == true ? false : true
vmOsType = var.os_type
})
}
# Obtain client configuration from the un-aliased provider
data "azurerm_client_config" "core" {
provider = azurerm
}