-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmain.tf
56 lines (44 loc) · 1.24 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
provider "azurerm" {
features {}
}
provider "azuread" {
}
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 2"
}
azuread = {
source = "hashicorp/azuread"
version = "~> 2"
}
}
}
// Example for subscription owner as PIM role
resource "azuread_group" "subscription_owner_group_1" {
display_name = "subscription_owner_group_1"
mail_enabled = false
security_enabled = true
}
module "pim_assignment_1" {
source = "./PIM Assignment - Subscription"
principal_id = azuread_group.subscription_owner_group_1.object_id
role_definition_name = "Owner"
}
// Example for contributor role on resource group
resource "azuread_group" "rg_contributor_group_1" {
display_name = "rg_contributor_group_1"
mail_enabled = false
security_enabled = true
}
resource "azurerm_resource_group" "rg1" {
name = "rg1"
location = "westeurope"
}
module "pim_assignment_2" {
source = "./PIM Assignment - Resource Group"
resource_group_name = azurerm_resource_group.rg1.name
principal_id = azuread_group.rg_contributor_group_1.object_id
role_definition_name = "Contributor"
}