我尝试用terraform创建一个模板以应用多个标记和值。具有各种政策的主动政策。 但是我不知道如何创建它。我使用了这个模板。
resource "azurerm_policy_set_definition" "test" { name = "testPolicySet" policy_type = "Custom" display_name = "Test Policy Set"
parameters = <<PARAMETERS
{
"tagName": {
"type": "String",
"metadata": {
"description": "Tag Name",
"displayName": "Tag Name"
}
}, "tagValue": {
"type": "String",
"metadata": {
"description": "Tag Value",
"displayName": "Tag Value"
}, "allowedValues": [
"foo",
"bar",
"foobar" ]
}
} PARAMETERS
policy_definitions = <<POLICY_DEFINITIONS
[
{
"parameters": {
"tagName": {
"value": "[parameters('tagName')]"
},
"tagValue": {
"value": "[parameters('tagValue')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62"
}
] POLICY_DEFINITIONS }