Policy Assignment module can deploy these resources:
- azurerm_management_group_policy_assignment (optional)
- azurerm_subscription_policy_assignment (optional)
NOTE: At least one of these needs to be specified in module configuration
Example variables structure is located in variables.md.
Example use case is located in test-case/locals.tf.
You can also see changelog.
Terraform documentation:
WARNING: AzureRM provider had been updated to a new major version. Many breaking changes were implemented. See the providers guide for more information.
There are a few things you need to do to import resources into .tfstate. In the example below there are resources which can be imported within the module. You may need to modify these commands to the OS on which they will be running (Refer to the documentation for additional details).
- terraform import '
<path-to-module>
.azurerm_management_group_policy_assignment.management_group_policy_assignment["<management-group-policy-assignment-name>
"]' '/providers/Microsoft.Management/managementGroups/<management-group-name>
/providers/Microsoft.Authorization/policyAssignments/<management-group-policy-assignment-name>
'
- terraform import '
<path-to-module>
.azurerm_subscription_policy_assignment.subscription_policy_assignment["<subscription-policy-assignment-name>
"]' '/subscriptions/<subscription-id>
/providers/Microsoft.Authorization/policyAssignments/<subscription-policy-assignment-name>
'
NOTE:
<path-to-module>
is terraform logical path from root. e.g. module.policy_assignment
Output Name | Value | Comment |
---|---|---|
outputs | name | |
id | ||
principal_id | principal_id (object_id) of system assigned identity |
This module can be deployed at either the subscription or management group level. The module will automatically determine which level it is being deployed at and use the appropriate id. See test-case/locals.tf for an example of how to deploy at different levels.
Parameters are passed into policy assignment through a json file. See test-case/locals.tf and test-case/parameters for an example of how to use this variable.
We currently log no issues in this module.