-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdsc.tf
61 lines (53 loc) · 2.18 KB
/
dsc.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
resource "random_string" "random" {
length = 8
special = false
}
resource "azurerm_automation_account" "aa" {
name = "aa-demo-${random_string.random.result}"
location = var.location
resource_group_name = azurerm_resource_group.rg.name
sku_name = "Basic"
}
resource "azurerm_automation_module" "dsc_modules" {
for_each = var.dsc_modules
name = each.key
resource_group_name = var.resource_group_name
automation_account_name = azurerm_automation_account.aa.name
module_link {
uri = each.value
}
}
resource "azurerm_automation_dsc_configuration" "timezone" {
name = "timezone"
resource_group_name = var.resource_group_name
automation_account_name = azurerm_automation_account.aa.name
location = var.location
content_embedded = "configuration timezone {}"
}
resource "azurerm_automation_dsc_nodeconfiguration" "timezone" {
name = "timezone.localhost"
resource_group_name = var.resource_group_name
automation_account_name = azurerm_automation_account.aa.name
depends_on = [azurerm_automation_dsc_configuration.timezone]
content_embedded = file("${path.cwd}/DSC/timezone/timezone/localhost.mof")
}
resource "azurerm_automation_variable_string" "dnsAddress" {
name = "dscDNSServer"
resource_group_name = var.resource_group_name
automation_account_name = azurerm_automation_account.aa.name
value = var.primary_dns_ip
}
resource "azurerm_automation_variable_string" "domainName" {
name = "dscDomainName"
resource_group_name = var.resource_group_name
automation_account_name = azurerm_automation_account.aa.name
value = var.ad_domain_name
}
resource "azurerm_automation_credential" "domain_admin" {
name = "dscDomainAdmin"
resource_group_name = var.resource_group_name
automation_account_name = azurerm_automation_account.aa.name
username = var.domain_admin_username
password = var.domain_admin_password
description = "This is a domain credential"
}