states.azurerm.log_analytics.workspace

Azure Resource Manager (ARM) Log Analytics Workspace State Module

New in version 2.0.0.

maintainer:

<devops@eitr.tech>

configuration:

This module requires Azure Resource Manager credentials to be passed via acct. Note that the authentication parameters are case sensitive.

Required provider parameters:

if using username and password:
  • subscription_id
  • username
  • password
if using a service principal:
  • subscription_id
  • tenant
  • client_id
  • secret

Optional provider parameters:

cloud_environment: Used to point the cloud driver to different API endpoints, such as Azure GovCloud. Possible values:

  • AZURE_PUBLIC_CLOUD (default)
  • AZURE_CHINA_CLOUD
  • AZURE_US_GOV_CLOUD
  • AZURE_GERMAN_CLOUD

Example acct setup for Azure Resource Manager authentication:

azurerm:
    default:
        subscription_id: 3287abc8-f98a-c678-3bde-326766fd3617
        tenant: ABCDEFAB-1234-ABCD-1234-ABCDEFABCDEF
        client_id: ABCDEFAB-1234-ABCD-1234-ABCDEFABCDEF
        secret: XXXXXXXXXXXXXXXXXXXXXXXX
        cloud_environment: AZURE_PUBLIC_CLOUD
    user_pass_auth:
        subscription_id: 3287abc8-f98a-c678-3bde-326766fd3617
        username: fletch
        password: 123pass

The authentication parameters can also be passed as a dictionary of keyword arguments to the connection_auth parameter of each state, but this is not preferred and could be deprecated in the future.

idem_azurerm.states.azurerm.log_analytics.workspace.absent(hub, ctx, name, resource_group, force=None, connection_auth=None, **kwargs)

New in version 2.0.0.

Changed in version 4.0.0.

Ensure the specified Log Analytics Workspace does not exist. A deleted workspace can be recovered if you recreate it in the same subscription, resource group and location. Upon deletion, the name of the Log Analytics Workspace is kept for 14 days and cannot be used for another workspace. To remove the workspace completely and release the name, use the force flag.

Parameters:
  • name – The name of the workspace.
  • resource_group – The resource group name of the workspace.
  • force – An optional boolean flag that specifies whether or not to delete the workspace without the option of recovery. A workspace that was deleted with this flag set as True cannot be recovered.
  • connection_auth – A dict with subscription and authentication parameters to be used in connecting to the Azure Resource Manager API.

Example usage:

Ensure log analytics workspace is absent:
    azurerm.log_analytics.workspace.absent:
        - name: my_workspace
        - resource_group: my_rg
idem_azurerm.states.azurerm.log_analytics.workspace.present(hub, ctx, name, resource_group, location, sku=None, retention=None, workspace_capping=None, ingestion_public_network_access=None, query_public_network_access=None, capacity_reservation_level=None, tags=None, connection_auth=None, **kwargs)

New in version 2.0.0.

Changed in version 4.0.0.

Ensure the specified log analytics workspace exists.

Parameters:
  • name – The name of the workspace. The name is case insensitive.
  • resource_group – The resource group name of the workspace.
  • location – The resource location.
  • sku – The name of the SKU. Possible values include: “Free”, “Standard”, “Premium”, “PerNode”, “PerGB2018”, “Standalone”, and “CapacityReservation”.
  • retention – The workspace data retention period in days. -1 means Unlimited retention for the Unlimited Sku. 730 days is the maximum allowed for all other Skus.
  • workspace_capping – A float representing the daily volume cap in GB for ingestion. -1 means unlimited.
  • ingestion_public_network_access – The network access type for accessing Log Analytics ingestion. Possible values include: “Enabled” and “Disabled”. Defaults to “Enabled”.
  • query_public_network_access – The network access type for accessing Log Analytics query. Possible values include: “Enabled” and “Disabled”. Defaults to “Enabled”.
  • capacity_reservation_level – An integer representing the capacity reservation level for this workspace. This parameter is only necessary when “CapacityReservation” is passed as the value of the sku parameter.
  • tags – A dictionary of strings can be passed as tag metadata to the workspace.
  • connection_auth – A dict with subscription and authentication parameters to be used in connecting to the Azure Resource Manager API.

Example usage:

Ensure log analytics workspace exists:
    azurerm.log_analytics.workspace.present:
        - name: my_workspace
        - resource_group: my_rg
        - location: my_location
        - tags:
            contact_name: Elmer Fudd Gantry