import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Manages a Diagnostic Setting for an existing Resource. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azure from "@pulumi/azure"; * * const example = new azure.core.ResourceGroup("example", { * name: "example-resources", * location: "West Europe", * }); * const exampleAccount = new azure.storage.Account("example", { * name: "storageaccountname", * resourceGroupName: example.name, * location: example.location, * accountTier: "Standard", * accountReplicationType: "LRS", * }); * const current = azure.core.getClientConfig({}); * const exampleKeyVault = new azure.keyvault.KeyVault("example", { * name: "examplekeyvault", * location: example.location, * resourceGroupName: example.name, * tenantId: current.then(current => current.tenantId), * softDeleteRetentionDays: 7, * purgeProtectionEnabled: false, * skuName: "standard", * }); * const exampleDiagnosticSetting = new azure.monitoring.DiagnosticSetting("example", { * name: "example", * targetResourceId: exampleKeyVault.id, * storageAccountId: exampleAccount.id, * enabledLogs: [{ * category: "AuditEvent", * }], * enabledMetrics: [{ * category: "AllMetrics", * }], * }); * ``` * * ## API Providers * * * This resource uses the following Azure API Providers: * * * `Microsoft.Insights` - 2021-05-01-preview * * ## Import * * Diagnostic Settings can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:monitoring/diagnosticSetting:DiagnosticSetting example "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.KeyVault/vaults/vault1|logMonitoring1" * ``` * * > **Note:** This is an ID specific to this resource provider which uses the format `{resourceId}|{diagnosticSettingName}` */ export declare class DiagnosticSetting extends pulumi.CustomResource { /** * Get an existing DiagnosticSetting 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?: DiagnosticSettingState, opts?: pulumi.CustomResourceOptions): DiagnosticSetting; /** * Returns true if the given object is an instance of DiagnosticSetting. 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 DiagnosticSetting; /** * One or more `enabledLog` blocks as defined below. * * > **Note:** At least one `enabledLog` or `enabledMetric` block must be specified. At least one type of Log or Metric must be enabled. */ readonly enabledLogs: pulumi.Output; /** * One or more `enabledMetric` blocks as defined below. * * > **Note:** At least one `enabledLog` or `enabledMetric` block must be specified. */ readonly enabledMetrics: pulumi.Output; /** * Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. * * > **NOTE:** This can be sourced from the `azure.eventhub.EventHubNamespaceAuthorizationRule` resource and is different from a `azure.eventhub.AuthorizationRule` resource. * * > **NOTE:** At least one of `eventhubAuthorizationRuleId`, `logAnalyticsWorkspaceId`, `partnerSolutionId` and `storageAccountId` must be specified. */ readonly eventhubAuthorizationRuleId: pulumi.Output; /** * Specifies the name of the Event Hub where Diagnostics Data should be sent. * * > **NOTE:** If this isn't specified then the default Event Hub will be used. */ readonly eventhubName: pulumi.Output; /** * Possible values are `AzureDiagnostics` and `Dedicated`. When set to `Dedicated`, logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy `AzureDiagnostics` table. * * > **NOTE:** This setting will only have an effect if a `logAnalyticsWorkspaceId` is provided. For some target resource type (e.g., Key Vault), this field is unconfigurable. Please see [resource types](https://learn.microsoft.com/en-us/azure/azure-monitor/reference/tables/azurediagnostics#resource-types) for services that use each method. Please [see the documentation](https://docs.microsoft.com/azure/azure-monitor/platform/diagnostic-logs-stream-log-store#azure-diagnostics-vs-resource-specific) for details on the differences between destination types. */ readonly logAnalyticsDestinationType: pulumi.Output; /** * Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent. * * > **NOTE:** At least one of `eventhubAuthorizationRuleId`, `logAnalyticsWorkspaceId`, `partnerSolutionId` and `storageAccountId` must be specified. */ readonly logAnalyticsWorkspaceId: pulumi.Output; /** * @deprecated `metric` has been deprecated in favour of the `enabledMetric` property and will be removed in v5.0 of the AzureRM provider */ readonly metrics: pulumi.Output; /** * Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created. * * > **NOTE:** If the name is set to 'service' it will not be possible to fully delete the diagnostic setting. This is due to legacy API support. */ readonly name: pulumi.Output; /** * The ID of the market partner solution where Diagnostics Data should be sent. For potential partner integrations, [click to learn more about partner integration](https://learn.microsoft.com/en-us/azure/partner-solutions/overview). * * > **NOTE:** At least one of `eventhubAuthorizationRuleId`, `logAnalyticsWorkspaceId`, `partnerSolutionId` and `storageAccountId` must be specified. */ readonly partnerSolutionId: pulumi.Output; /** * The ID of the Storage Account where logs should be sent. * * > **NOTE:** At least one of `eventhubAuthorizationRuleId`, `logAnalyticsWorkspaceId`, `partnerSolutionId` and `storageAccountId` must be specified. */ readonly storageAccountId: pulumi.Output; /** * The ID of an existing Resource on which to configure Diagnostic Settings. Changing this forces a new resource to be created. */ readonly targetResourceId: pulumi.Output; /** * Create a DiagnosticSetting 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: DiagnosticSettingArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering DiagnosticSetting resources. */ export interface DiagnosticSettingState { /** * One or more `enabledLog` blocks as defined below. * * > **Note:** At least one `enabledLog` or `enabledMetric` block must be specified. At least one type of Log or Metric must be enabled. */ enabledLogs?: pulumi.Input[]>; /** * One or more `enabledMetric` blocks as defined below. * * > **Note:** At least one `enabledLog` or `enabledMetric` block must be specified. */ enabledMetrics?: pulumi.Input[]>; /** * Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. * * > **NOTE:** This can be sourced from the `azure.eventhub.EventHubNamespaceAuthorizationRule` resource and is different from a `azure.eventhub.AuthorizationRule` resource. * * > **NOTE:** At least one of `eventhubAuthorizationRuleId`, `logAnalyticsWorkspaceId`, `partnerSolutionId` and `storageAccountId` must be specified. */ eventhubAuthorizationRuleId?: pulumi.Input; /** * Specifies the name of the Event Hub where Diagnostics Data should be sent. * * > **NOTE:** If this isn't specified then the default Event Hub will be used. */ eventhubName?: pulumi.Input; /** * Possible values are `AzureDiagnostics` and `Dedicated`. When set to `Dedicated`, logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy `AzureDiagnostics` table. * * > **NOTE:** This setting will only have an effect if a `logAnalyticsWorkspaceId` is provided. For some target resource type (e.g., Key Vault), this field is unconfigurable. Please see [resource types](https://learn.microsoft.com/en-us/azure/azure-monitor/reference/tables/azurediagnostics#resource-types) for services that use each method. Please [see the documentation](https://docs.microsoft.com/azure/azure-monitor/platform/diagnostic-logs-stream-log-store#azure-diagnostics-vs-resource-specific) for details on the differences between destination types. */ logAnalyticsDestinationType?: pulumi.Input; /** * Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent. * * > **NOTE:** At least one of `eventhubAuthorizationRuleId`, `logAnalyticsWorkspaceId`, `partnerSolutionId` and `storageAccountId` must be specified. */ logAnalyticsWorkspaceId?: pulumi.Input; /** * @deprecated `metric` has been deprecated in favour of the `enabledMetric` property and will be removed in v5.0 of the AzureRM provider */ metrics?: pulumi.Input[]>; /** * Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created. * * > **NOTE:** If the name is set to 'service' it will not be possible to fully delete the diagnostic setting. This is due to legacy API support. */ name?: pulumi.Input; /** * The ID of the market partner solution where Diagnostics Data should be sent. For potential partner integrations, [click to learn more about partner integration](https://learn.microsoft.com/en-us/azure/partner-solutions/overview). * * > **NOTE:** At least one of `eventhubAuthorizationRuleId`, `logAnalyticsWorkspaceId`, `partnerSolutionId` and `storageAccountId` must be specified. */ partnerSolutionId?: pulumi.Input; /** * The ID of the Storage Account where logs should be sent. * * > **NOTE:** At least one of `eventhubAuthorizationRuleId`, `logAnalyticsWorkspaceId`, `partnerSolutionId` and `storageAccountId` must be specified. */ storageAccountId?: pulumi.Input; /** * The ID of an existing Resource on which to configure Diagnostic Settings. Changing this forces a new resource to be created. */ targetResourceId?: pulumi.Input; } /** * The set of arguments for constructing a DiagnosticSetting resource. */ export interface DiagnosticSettingArgs { /** * One or more `enabledLog` blocks as defined below. * * > **Note:** At least one `enabledLog` or `enabledMetric` block must be specified. At least one type of Log or Metric must be enabled. */ enabledLogs?: pulumi.Input[]>; /** * One or more `enabledMetric` blocks as defined below. * * > **Note:** At least one `enabledLog` or `enabledMetric` block must be specified. */ enabledMetrics?: pulumi.Input[]>; /** * Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. * * > **NOTE:** This can be sourced from the `azure.eventhub.EventHubNamespaceAuthorizationRule` resource and is different from a `azure.eventhub.AuthorizationRule` resource. * * > **NOTE:** At least one of `eventhubAuthorizationRuleId`, `logAnalyticsWorkspaceId`, `partnerSolutionId` and `storageAccountId` must be specified. */ eventhubAuthorizationRuleId?: pulumi.Input; /** * Specifies the name of the Event Hub where Diagnostics Data should be sent. * * > **NOTE:** If this isn't specified then the default Event Hub will be used. */ eventhubName?: pulumi.Input; /** * Possible values are `AzureDiagnostics` and `Dedicated`. When set to `Dedicated`, logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy `AzureDiagnostics` table. * * > **NOTE:** This setting will only have an effect if a `logAnalyticsWorkspaceId` is provided. For some target resource type (e.g., Key Vault), this field is unconfigurable. Please see [resource types](https://learn.microsoft.com/en-us/azure/azure-monitor/reference/tables/azurediagnostics#resource-types) for services that use each method. Please [see the documentation](https://docs.microsoft.com/azure/azure-monitor/platform/diagnostic-logs-stream-log-store#azure-diagnostics-vs-resource-specific) for details on the differences between destination types. */ logAnalyticsDestinationType?: pulumi.Input; /** * Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent. * * > **NOTE:** At least one of `eventhubAuthorizationRuleId`, `logAnalyticsWorkspaceId`, `partnerSolutionId` and `storageAccountId` must be specified. */ logAnalyticsWorkspaceId?: pulumi.Input; /** * @deprecated `metric` has been deprecated in favour of the `enabledMetric` property and will be removed in v5.0 of the AzureRM provider */ metrics?: pulumi.Input[]>; /** * Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created. * * > **NOTE:** If the name is set to 'service' it will not be possible to fully delete the diagnostic setting. This is due to legacy API support. */ name?: pulumi.Input; /** * The ID of the market partner solution where Diagnostics Data should be sent. For potential partner integrations, [click to learn more about partner integration](https://learn.microsoft.com/en-us/azure/partner-solutions/overview). * * > **NOTE:** At least one of `eventhubAuthorizationRuleId`, `logAnalyticsWorkspaceId`, `partnerSolutionId` and `storageAccountId` must be specified. */ partnerSolutionId?: pulumi.Input; /** * The ID of the Storage Account where logs should be sent. * * > **NOTE:** At least one of `eventhubAuthorizationRuleId`, `logAnalyticsWorkspaceId`, `partnerSolutionId` and `storageAccountId` must be specified. */ storageAccountId?: pulumi.Input; /** * The ID of an existing Resource on which to configure Diagnostic Settings. Changing this forces a new resource to be created. */ targetResourceId: pulumi.Input; }