-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcustom_roles.tf
73 lines (64 loc) · 2.86 KB
/
custom_roles.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
// Scope : MONITORED_SUBSCRIPTION
// Use : Enumerate Instances & Access Disks in monitored resource groups for snapshot creation
resource "azurerm_role_definition" "agentless_monitored_subscription" {
count = var.global ? 1 : 0
name = replace("${var.prefix}-snapshot-${local.suffix}", "-", "_")
scope = local.monitored_role_scopes[0]
permissions {
actions = [
"Microsoft.Compute/disks/read",
"Microsoft.Compute/disks/beginGetAccess/action",
"Microsoft.Compute/virtualMachines/instanceView/read",
"Microsoft.Compute/virtualMachines/read",
"Microsoft.Compute/virtualMachineScaleSets/read",
"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/read",
"Microsoft.Compute/snapshots/read",
"Microsoft.Compute/snapshots/write",
"Microsoft.Compute/snapshots/delete",
"Microsoft.Compute/snapshots/beginGetAccess/action",
"Microsoft.Compute/snapshots/endGetAccess/action",
"Microsoft.Resources/subscriptions/resourceGroups/read",
]
not_actions = []
}
assignable_scopes = local.monitored_role_scopes
}
//-----------------------------------------------------------------------------------
// Scope : SCANNING_SUBSCRIPTION
// Use : Create & Delete resources in scanner subscription
// Role for Scanner Instances to interact with resources in Scanner subscription
resource "azurerm_role_definition" "agentless_scanning_subscription" {
count = var.global ? 1 : 0
name = replace("${var.prefix}-scanner-${local.suffix}", "-", "_")
scope = local.scanning_subscription_id
permissions {
actions = [
"Microsoft.Authorization/*/read",
"Microsoft.Compute/locations/*",
"Microsoft.Compute/virtualMachines/*",
"Microsoft.Compute/virtualMachineScaleSets/read",
"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/read",
"Microsoft.Compute/cloudServices/*",
"Microsoft.Compute/disks/write",
"Microsoft.Compute/disks/read",
"Microsoft.Compute/disks/delete",
"Microsoft.CostManagement/*/read",
"Microsoft.Network/locations/*",
"Microsoft.Network/networkInterfaces/*",
"Microsoft.Network/networkSecurityGroups/join/action",
"Microsoft.Network/networkSecurityGroups/read",
"Microsoft.Network/virtualNetworks/read",
"Microsoft.Network/virtualNetworks/subnets/join/action",
"Microsoft.Resources/subscriptions/resourceGroups/read",
"Microsoft.Storage/storageAccounts/listKeys/action",
"Microsoft.Storage/storageAccounts/read",
"Microsoft.ManagedIdentity/userAssignedIdentities/*/read",
"Microsoft.ManagedIdentity/userAssignedIdentities/*/assign/action",
"Microsoft.Network/publicIPAddresses/join/action",
"Microsoft.Network/publicIPAddresses/read",
"Microsoft.Network/publicIPAddresses/write",
]
not_actions = []
}
assignable_scopes = [local.scanning_subscription_id]
}