import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Manages a AutoScale Setting which can be applied to Virtual Machine Scale Sets, App Services and other scalable resources. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azure from "@pulumi/azure"; * * const example = new azure.core.ResourceGroup("example", { * name: "autoscalingTest", * location: "West Europe", * }); * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", { * name: "acctvn", * addressSpaces: ["10.0.0.0/16"], * location: example.location, * resourceGroupName: example.name, * }); * const exampleSubnet = new azure.network.Subnet("example", { * name: "acctsub", * resourceGroupName: example.name, * virtualNetworkName: exampleVirtualNetwork.name, * addressPrefixes: ["10.0.2.0/24"], * }); * const exampleLinuxVirtualMachineScaleSet = new azure.compute.LinuxVirtualMachineScaleSet("example", { * name: "exampleset", * location: example.location, * resourceGroupName: example.name, * upgradeMode: "Manual", * sku: "Standard_F2", * instances: 2, * adminUsername: "myadmin", * adminSshKeys: [{ * username: "myadmin", * publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com", * }], * networkInterfaces: [{ * name: "TestNetworkProfile", * primary: true, * ipConfigurations: [{ * name: "TestIPConfiguration", * primary: true, * subnetId: exampleSubnet.id, * }], * }], * osDisk: { * caching: "ReadWrite", * storageAccountType: "StandardSSD_LRS", * }, * sourceImageReference: { * publisher: "Canonical", * offer: "0001-com-ubuntu-server-jammy", * sku: "22_04-lts", * version: "latest", * }, * }); * const exampleAutoscaleSetting = new azure.monitoring.AutoscaleSetting("example", { * name: "myAutoscaleSetting", * resourceGroupName: example.name, * location: example.location, * targetResourceId: exampleLinuxVirtualMachineScaleSet.id, * profiles: [{ * name: "defaultProfile", * capacity: { * "default": 1, * minimum: 1, * maximum: 10, * }, * rules: [ * { * metricTrigger: { * metricName: "Percentage CPU", * metricResourceId: exampleLinuxVirtualMachineScaleSet.id, * timeGrain: "PT1M", * statistic: "Average", * timeWindow: "PT5M", * timeAggregation: "Average", * operator: "GreaterThan", * threshold: 75, * metricNamespace: "microsoft.compute/virtualmachinescalesets", * dimensions: [{ * name: "AppName", * operator: "Equals", * values: ["App1"], * }], * }, * scaleAction: { * direction: "Increase", * type: "ChangeCount", * value: 1, * cooldown: "PT1M", * }, * }, * { * metricTrigger: { * metricName: "Percentage CPU", * metricResourceId: exampleLinuxVirtualMachineScaleSet.id, * timeGrain: "PT1M", * statistic: "Average", * timeWindow: "PT5M", * timeAggregation: "Average", * operator: "LessThan", * threshold: 25, * }, * scaleAction: { * direction: "Decrease", * type: "ChangeCount", * value: 1, * cooldown: "PT1M", * }, * }, * ], * }], * predictive: { * scaleMode: "Enabled", * lookAheadTime: "PT5M", * }, * notification: { * email: { * sendToSubscriptionAdministrator: true, * sendToSubscriptionCoAdministrator: true, * customEmails: ["admin@contoso.com"], * }, * }, * }); * ``` * * ### Repeating On Weekends) * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azure from "@pulumi/azure"; * * const example = new azure.core.ResourceGroup("example", { * name: "autoscalingTest", * location: "West Europe", * }); * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", { * name: "acctvn", * addressSpaces: ["10.0.0.0/16"], * location: example.location, * resourceGroupName: example.name, * }); * const exampleSubnet = new azure.network.Subnet("example", { * name: "acctsub", * resourceGroupName: example.name, * virtualNetworkName: exampleVirtualNetwork.name, * addressPrefixes: ["10.0.2.0/24"], * }); * const exampleLinuxVirtualMachineScaleSet = new azure.compute.LinuxVirtualMachineScaleSet("example", { * name: "exampleset", * location: example.location, * resourceGroupName: example.name, * upgradeMode: "Manual", * sku: "Standard_F2", * instances: 2, * adminUsername: "myadmin", * adminSshKeys: [{ * username: "myadmin", * publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com", * }], * networkInterfaces: [{ * name: "TestNetworkProfile", * primary: true, * ipConfigurations: [{ * name: "TestIPConfiguration", * primary: true, * subnetId: exampleSubnet.id, * }], * }], * osDisk: { * caching: "ReadWrite", * storageAccountType: "StandardSSD_LRS", * }, * sourceImageReference: { * publisher: "Canonical", * offer: "0001-com-ubuntu-server-jammy", * sku: "22_04-lts", * version: "latest", * }, * }); * const exampleAutoscaleSetting = new azure.monitoring.AutoscaleSetting("example", { * name: "myAutoscaleSetting", * resourceGroupName: example.name, * location: example.location, * targetResourceId: exampleLinuxVirtualMachineScaleSet.id, * profiles: [{ * name: "Weekends", * capacity: { * "default": 1, * minimum: 1, * maximum: 10, * }, * rules: [ * { * metricTrigger: { * metricName: "Percentage CPU", * metricResourceId: exampleLinuxVirtualMachineScaleSet.id, * timeGrain: "PT1M", * statistic: "Average", * timeWindow: "PT5M", * timeAggregation: "Average", * operator: "GreaterThan", * threshold: 90, * }, * scaleAction: { * direction: "Increase", * type: "ChangeCount", * value: 2, * cooldown: "PT1M", * }, * }, * { * metricTrigger: { * metricName: "Percentage CPU", * metricResourceId: exampleLinuxVirtualMachineScaleSet.id, * timeGrain: "PT1M", * statistic: "Average", * timeWindow: "PT5M", * timeAggregation: "Average", * operator: "LessThan", * threshold: 10, * }, * scaleAction: { * direction: "Decrease", * type: "ChangeCount", * value: 2, * cooldown: "PT1M", * }, * }, * ], * recurrence: { * timezone: "Pacific Standard Time", * days: [ * "Saturday", * "Sunday", * ], * hours: 12, * minutes: 0, * }, * }], * notification: { * email: { * sendToSubscriptionAdministrator: true, * sendToSubscriptionCoAdministrator: true, * customEmails: ["admin@contoso.com"], * }, * }, * }); * ``` * * ### For Fixed Dates) * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azure from "@pulumi/azure"; * * const example = new azure.core.ResourceGroup("example", { * name: "autoscalingTest", * location: "West Europe", * }); * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", { * name: "acctvn", * addressSpaces: ["10.0.0.0/16"], * location: example.location, * resourceGroupName: example.name, * }); * const exampleSubnet = new azure.network.Subnet("example", { * name: "acctsub", * resourceGroupName: example.name, * virtualNetworkName: exampleVirtualNetwork.name, * addressPrefixes: ["10.0.2.0/24"], * }); * const exampleLinuxVirtualMachineScaleSet = new azure.compute.LinuxVirtualMachineScaleSet("example", { * name: "exampleset", * location: example.location, * resourceGroupName: example.name, * upgradeMode: "Manual", * sku: "Standard_F2", * instances: 2, * adminUsername: "myadmin", * adminSshKeys: [{ * username: "myadmin", * publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com", * }], * networkInterfaces: [{ * name: "TestNetworkProfile", * primary: true, * ipConfigurations: [{ * name: "TestIPConfiguration", * primary: true, * subnetId: exampleSubnet.id, * }], * }], * osDisk: { * caching: "ReadWrite", * storageAccountType: "StandardSSD_LRS", * }, * sourceImageReference: { * publisher: "Canonical", * offer: "0001-com-ubuntu-server-jammy", * sku: "22_04-lts", * version: "latest", * }, * }); * const exampleAutoscaleSetting = new azure.monitoring.AutoscaleSetting("example", { * name: "myAutoscaleSetting", * enabled: true, * resourceGroupName: example.name, * location: example.location, * targetResourceId: exampleLinuxVirtualMachineScaleSet.id, * profiles: [{ * name: "forJuly", * capacity: { * "default": 1, * minimum: 1, * maximum: 10, * }, * rules: [ * { * metricTrigger: { * metricName: "Percentage CPU", * metricResourceId: exampleLinuxVirtualMachineScaleSet.id, * timeGrain: "PT1M", * statistic: "Average", * timeWindow: "PT5M", * timeAggregation: "Average", * operator: "GreaterThan", * threshold: 90, * }, * scaleAction: { * direction: "Increase", * type: "ChangeCount", * value: 2, * cooldown: "PT1M", * }, * }, * { * metricTrigger: { * metricName: "Percentage CPU", * metricResourceId: exampleLinuxVirtualMachineScaleSet.id, * timeGrain: "PT1M", * statistic: "Average", * timeWindow: "PT5M", * timeAggregation: "Average", * operator: "LessThan", * threshold: 10, * }, * scaleAction: { * direction: "Decrease", * type: "ChangeCount", * value: 2, * cooldown: "PT1M", * }, * }, * ], * fixedDate: { * timezone: "Pacific Standard Time", * start: "2020-07-01T00:00:00Z", * end: "2020-07-31T23:59:59Z", * }, * }], * notification: { * email: { * sendToSubscriptionAdministrator: true, * sendToSubscriptionCoAdministrator: true, * customEmails: ["admin@contoso.com"], * }, * }, * }); * ``` * * ## API Providers * * * This resource uses the following Azure API Providers: * * * `Microsoft.Insights` - 2022-10-01 * * ## Import * * AutoScale Setting can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:monitoring/autoscaleSetting:AutoscaleSetting example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Insights/autoScaleSettings/setting1 * ``` */ export declare class AutoscaleSetting extends pulumi.CustomResource { /** * Get an existing AutoscaleSetting 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?: AutoscaleSettingState, opts?: pulumi.CustomResourceOptions): AutoscaleSetting; /** * Returns true if the given object is an instance of AutoscaleSetting. 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 AutoscaleSetting; /** * Specifies whether automatic scaling is enabled for the target resource. Defaults to `true`. */ readonly enabled: pulumi.Output; /** * Specifies the supported Azure location where the AutoScale Setting should exist. Changing this forces a new resource to be created. */ readonly location: pulumi.Output; /** * The name of the AutoScale Setting. Changing this forces a new resource to be created. */ readonly name: pulumi.Output; /** * Specifies a `notification` block as defined below. */ readonly notification: pulumi.Output; /** * A `predictive` block as defined below. */ readonly predictive: pulumi.Output; /** * Specifies one or more (up to 20) `profile` blocks as defined below. */ readonly profiles: pulumi.Output; /** * The name of the Resource Group in the AutoScale Setting should be created. Changing this forces a new resource to be created. */ readonly resourceGroupName: pulumi.Output; /** * A mapping of tags to assign to the resource. */ readonly tags: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Specifies the resource ID of the resource that the autoscale setting should be added to. Changing this forces a new resource to be created. */ readonly targetResourceId: pulumi.Output; /** * Create a AutoscaleSetting 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: AutoscaleSettingArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering AutoscaleSetting resources. */ export interface AutoscaleSettingState { /** * Specifies whether automatic scaling is enabled for the target resource. Defaults to `true`. */ enabled?: pulumi.Input; /** * Specifies the supported Azure location where the AutoScale Setting should exist. Changing this forces a new resource to be created. */ location?: pulumi.Input; /** * The name of the AutoScale Setting. Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * Specifies a `notification` block as defined below. */ notification?: pulumi.Input; /** * A `predictive` block as defined below. */ predictive?: pulumi.Input; /** * Specifies one or more (up to 20) `profile` blocks as defined below. */ profiles?: pulumi.Input[]>; /** * The name of the Resource Group in the AutoScale Setting should be created. Changing this forces a new resource to be created. */ resourceGroupName?: pulumi.Input; /** * A mapping of tags to assign to the resource. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Specifies the resource ID of the resource that the autoscale setting should be added to. Changing this forces a new resource to be created. */ targetResourceId?: pulumi.Input; } /** * The set of arguments for constructing a AutoscaleSetting resource. */ export interface AutoscaleSettingArgs { /** * Specifies whether automatic scaling is enabled for the target resource. Defaults to `true`. */ enabled?: pulumi.Input; /** * Specifies the supported Azure location where the AutoScale Setting should exist. Changing this forces a new resource to be created. */ location?: pulumi.Input; /** * The name of the AutoScale Setting. Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * Specifies a `notification` block as defined below. */ notification?: pulumi.Input; /** * A `predictive` block as defined below. */ predictive?: pulumi.Input; /** * Specifies one or more (up to 20) `profile` blocks as defined below. */ profiles: pulumi.Input[]>; /** * The name of the Resource Group in the AutoScale Setting should be created. Changing this forces a new resource to be created. */ resourceGroupName: pulumi.Input; /** * A mapping of tags to assign to the resource. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Specifies the resource ID of the resource that the autoscale setting should be added to. Changing this forces a new resource to be created. */ targetResourceId: pulumi.Input; }