import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Manages a Subscription Policy Assignment. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azure from "@pulumi/azure"; * * const current = azure.core.getSubscription({}); * const example = new azure.policy.Definition("example", { * name: "only-deploy-in-westeurope", * policyType: "Custom", * mode: "All", * displayName: "Allowed resource types", * policyRule: ` { * "if": { * "not": { * "field": "location", * "equals": "westeurope" * } * }, * "then": { * "effect": "Deny" * } * } * `, * }); * const exampleSubscriptionPolicyAssignment = new azure.core.SubscriptionPolicyAssignment("example", { * name: "example", * policyDefinitionId: example.id, * subscriptionId: current.then(current => current.id), * }); * ``` * * ## API Providers * * * This resource uses the following Azure API Providers: * * * `Microsoft.Authorization` - 2022-06-01 * * ## Import * * Subscription Policy Assignments can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:core/subscriptionPolicyAssignment:SubscriptionPolicyAssignment example /subscriptions/00000000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/assignment1 * ``` */ export declare class SubscriptionPolicyAssignment extends pulumi.CustomResource { /** * Get an existing SubscriptionPolicyAssignment resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: SubscriptionPolicyAssignmentState, opts?: pulumi.CustomResourceOptions): SubscriptionPolicyAssignment; /** * Returns true if the given object is an instance of SubscriptionPolicyAssignment. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is SubscriptionPolicyAssignment; /** * A description which should be used for this Policy Assignment. */ readonly description: pulumi.Output; /** * The Display Name for this Policy Assignment. */ readonly displayName: pulumi.Output; /** * Specifies if this Policy should be enforced or not? Defaults to `true`. */ readonly enforce: pulumi.Output; /** * An `identity` block as defined below. * * > **Note:** The `location` field must also be specified when `identity` is specified. */ readonly identity: pulumi.Output; /** * The Azure Region where the Policy Assignment should exist. Changing this forces a new Policy Assignment to be created. */ readonly location: pulumi.Output; /** * A JSON mapping of any Metadata for this Policy. */ readonly metadata: pulumi.Output; /** * The name which should be used for this Policy Assignment. Changing this forces a new Policy Assignment to be created. Cannot exceed 64 characters in length. */ readonly name: pulumi.Output; /** * One or more `nonComplianceMessage` blocks as defined below. */ readonly nonComplianceMessages: pulumi.Output; /** * Specifies a list of Resource Scopes (for example a Subscription, or a Resource Group) within this Management Group which are excluded from this Policy. */ readonly notScopes: pulumi.Output; /** * One or more `overrides` blocks as defined below. More detail about `overrides` and `resourceSelectors` see [policy assignment structure](https://learn.microsoft.com/en-us/azure/governance/policy/concepts/assignment-structure) */ readonly overrides: pulumi.Output; /** * A JSON mapping of any Parameters for this Policy. */ readonly parameters: pulumi.Output; /** * The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created. */ readonly policyDefinitionId: pulumi.Output; /** * One or more `resourceSelectors` blocks as defined below to filter polices by resource properties. */ readonly resourceSelectors: pulumi.Output; /** * The ID of the Subscription where this Policy Assignment should be created. Changing this forces a new Policy Assignment to be created. */ readonly subscriptionId: pulumi.Output; /** * Create a SubscriptionPolicyAssignment resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: SubscriptionPolicyAssignmentArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering SubscriptionPolicyAssignment resources. */ export interface SubscriptionPolicyAssignmentState { /** * A description which should be used for this Policy Assignment. */ description?: pulumi.Input; /** * The Display Name for this Policy Assignment. */ displayName?: pulumi.Input; /** * Specifies if this Policy should be enforced or not? Defaults to `true`. */ enforce?: pulumi.Input; /** * An `identity` block as defined below. * * > **Note:** The `location` field must also be specified when `identity` is specified. */ identity?: pulumi.Input; /** * The Azure Region where the Policy Assignment should exist. Changing this forces a new Policy Assignment to be created. */ location?: pulumi.Input; /** * A JSON mapping of any Metadata for this Policy. */ metadata?: pulumi.Input; /** * The name which should be used for this Policy Assignment. Changing this forces a new Policy Assignment to be created. Cannot exceed 64 characters in length. */ name?: pulumi.Input; /** * One or more `nonComplianceMessage` blocks as defined below. */ nonComplianceMessages?: pulumi.Input[]>; /** * Specifies a list of Resource Scopes (for example a Subscription, or a Resource Group) within this Management Group which are excluded from this Policy. */ notScopes?: pulumi.Input[]>; /** * One or more `overrides` blocks as defined below. More detail about `overrides` and `resourceSelectors` see [policy assignment structure](https://learn.microsoft.com/en-us/azure/governance/policy/concepts/assignment-structure) */ overrides?: pulumi.Input[]>; /** * A JSON mapping of any Parameters for this Policy. */ parameters?: pulumi.Input; /** * The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created. */ policyDefinitionId?: pulumi.Input; /** * One or more `resourceSelectors` blocks as defined below to filter polices by resource properties. */ resourceSelectors?: pulumi.Input[]>; /** * The ID of the Subscription where this Policy Assignment should be created. Changing this forces a new Policy Assignment to be created. */ subscriptionId?: pulumi.Input; } /** * The set of arguments for constructing a SubscriptionPolicyAssignment resource. */ export interface SubscriptionPolicyAssignmentArgs { /** * A description which should be used for this Policy Assignment. */ description?: pulumi.Input; /** * The Display Name for this Policy Assignment. */ displayName?: pulumi.Input; /** * Specifies if this Policy should be enforced or not? Defaults to `true`. */ enforce?: pulumi.Input; /** * An `identity` block as defined below. * * > **Note:** The `location` field must also be specified when `identity` is specified. */ identity?: pulumi.Input; /** * The Azure Region where the Policy Assignment should exist. Changing this forces a new Policy Assignment to be created. */ location?: pulumi.Input; /** * A JSON mapping of any Metadata for this Policy. */ metadata?: pulumi.Input; /** * The name which should be used for this Policy Assignment. Changing this forces a new Policy Assignment to be created. Cannot exceed 64 characters in length. */ name?: pulumi.Input; /** * One or more `nonComplianceMessage` blocks as defined below. */ nonComplianceMessages?: pulumi.Input[]>; /** * Specifies a list of Resource Scopes (for example a Subscription, or a Resource Group) within this Management Group which are excluded from this Policy. */ notScopes?: pulumi.Input[]>; /** * One or more `overrides` blocks as defined below. More detail about `overrides` and `resourceSelectors` see [policy assignment structure](https://learn.microsoft.com/en-us/azure/governance/policy/concepts/assignment-structure) */ overrides?: pulumi.Input[]>; /** * A JSON mapping of any Parameters for this Policy. */ parameters?: pulumi.Input; /** * The ID of the Policy Definition or Policy Definition Set. Changing this forces a new Policy Assignment to be created. */ policyDefinitionId: pulumi.Input; /** * One or more `resourceSelectors` blocks as defined below to filter polices by resource properties. */ resourceSelectors?: pulumi.Input[]>; /** * The ID of the Subscription where this Policy Assignment should be created. Changing this forces a new Policy Assignment to be created. */ subscriptionId: pulumi.Input; }