pulumi / pulumi-policy

Pulumi's Policy as Code SDK, CrossGuard. Define infrastructure checks in code to enforce security, compliance, cost, and other practices, enforced at deployment time.
https://www.pulumi.com/docs/guides/crossguard/
Apache License 2.0
34 stars 5 forks source link

Import existing Azure Policy resources as Pulumi policies #285

Open praneetloke opened 2 years ago

praneetloke commented 2 years ago

Hello!

Issue details

I have policies created using Azure Policy. I'd like to convert them to Pulumi policies by importing them.

Expand to see an example of a policy definition ```json { "properties": { "displayName": "Vulnerability Assessment settings for SQL server should contain an email address to receive scan reports", "policyType": "BuiltIn", "mode": "Indexed", "description": "Ensure that an email address is provided for the 'Send scan reports to' field in the Vulnerability Assessment settings. This email address receives scan result summary after a periodic scan runs on SQL servers.", "metadata": { "version": "2.0.0", "category": "SQL" }, "parameters": { "effect": { "type": "String", "metadata": { "displayName": "Effect", "description": "Enable or disable the execution of the policy" }, "allowedValues": [ "AuditIfNotExists", "Disabled" ], "defaultValue": "AuditIfNotExists" } }, "policyRule": { "if": { "field": "type", "equals": "Microsoft.Sql/servers" }, "then": { "effect": "[parameters('effect')]", "details": { "type": "Microsoft.Sql/servers/vulnerabilityAssessments", "name": "default", "existenceCondition": { "allOf": [ { "field": "Microsoft.Sql/servers/vulnerabilityAssessments/default.recurringScans.emails[*]", "notEquals": "" }, { "count": { "field": "Microsoft.Sql/servers/vulnerabilityAssessments/default.recurringScans.emails[*]" }, "notEquals": 0 } ] } } } } }, ... } ```

Affected area/feature

KamilLach commented 9 months ago

That would be really cool to reuse existing policy definitions and import them as cross guards.