states.azurerm.dns.zone

Azure Resource Manager (ARM) DNS Zone State Module

New in version 1.0.0.

Changed in version 4.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.dns.zone.absent(hub, ctx, name, resource_group, connection_auth=None, **kwargs)

New in version 1.0.0.

Ensure a DNS zone does not exist in the resource group.

Parameters:
  • name – Name of the DNS zone.
  • resource_group – The resource group assigned to the DNS zone.
  • connection_auth – A dict with subscription and authentication parameters to be used in connecting to the Azure Resource Manager API.

Example usage:

Ensure zone absent:
    azurerm.dns.zone.absent:
      - name: test_machine
      - resource_group: test_group
idem_azurerm.states.azurerm.dns.zone.present(hub, ctx, name, resource_group, etag=None, if_match=None, if_none_match=None, registration_virtual_networks=None, resolution_virtual_networks=None, tags=None, zone_type='Public', connection_auth=None, **kwargs)

New in version 1.0.0.

Changed in version 4.0.0.

Ensure a DNS zone exists.

Parameters:
  • name – Name of the DNS zone (without a terminating dot).
  • resource_group – The resource group assigned to the DNS zone.
  • etag – The etag of the zone. Etags are used to handle concurrent changes to the same resource safely.
  • if_match – The etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen etag value to prevent accidentally overwritting any concurrent changes.
  • if_none_match – Set to ‘*’ to allow a new DNS zone to be created, but to prevent updating an existing zone. Other values will be ignored.
  • registration_virtual_networks – A list of references to virtual networks that register hostnames in this DNS zone. This is only when zone_type is Private. (requires azure-mgmt-dns >= 2.0.0rc1)
  • resolution_virtual_networks – A list of references to virtual networks that resolve records in this DNS zone. This is only when zone_type is Private. (requires azure-mgmt-dns >= 2.0.0rc1)
  • tags – A dictionary of strings can be passed as tag metadata to the DNS zone object.
  • zone_type
    The type of this DNS zone (Public or Private). Possible values include: ‘Public’, ‘Private’. Default value: ‘Public’
    (requires azure-mgmt-dns >= 2.0.0rc1)
  • connection_auth – A dict with subscription and authentication parameters to be used in connecting to the Azure Resource Manager API.

Example usage:

Ensure DNS zone exists:
    azurerm.dns.zone.present:
        - name: contoso.com
        - resource_group: my_rg
        - zone_type: Private
        - registration_virtual_networks:
          - /subscriptions/{{ sub }}/resourceGroups/my_rg/providers/Microsoft.Network/virtualNetworks/test_vnet
        - tags:
            how_awesome: very
            contact_name: Elmer Fudd Gantry