states.azurerm.dns.record_set

Azure Resource Manager (ARM) DNS Record Set 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.record_set.absent(hub, ctx, name, zone_name, resource_group, record_type, connection_auth=None, **kwargs)

New in version 1.0.0.

Ensure a record set does not exist in the DNS zone.

Parameters:
  • name – Name of the record set.
  • zone_name – Name of the DNS zone.
  • resource_group – The resource group assigned to the DNS zone.
  • record_type – The type of DNS record in this record set. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created). Possible values include: ‘A’, ‘AAAA’, ‘CAA’, ‘CNAME’, ‘MX’, ‘NS’, ‘PTR’, ‘SOA’, ‘SRV’, ‘TXT’
  • connection_auth – A dict with subscription and authentication parameters to be used in connecting to the Azure Resource Manager API.

Example usage:

Ensure record set absent:
    azurerm.dns.record_set.absent:
        - name: test_set
        - zone: test_zone
        - resource_group: test_group
        - record_type: test_type
idem_azurerm.states.azurerm.dns.record_set.present(hub, ctx, name, zone_name, resource_group, record_type, if_match=None, if_none_match=None, etag=None, metadata=None, ttl=None, arecords=None, aaaa_records=None, mx_records=None, ns_records=None, ptr_records=None, srv_records=None, txt_records=None, cname_record=None, soa_record=None, caa_records=None, connection_auth=None, **kwargs)

New in version 1.0.0.

Changed in version 4.0.0.

Ensure a record set exists in a DNS zone.

Parameters:
  • name – The name of the record set, relative to the name of the zone.
  • zone_name – Name of the DNS zone (without a terminating dot).
  • resource_group – The resource group assigned to the DNS zone.
  • record_type – The type of DNS record in this record set. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created). Possible values include: ‘A’, ‘AAAA’, ‘CAA’, ‘CNAME’, ‘MX’, ‘NS’, ‘PTR’, ‘SOA’, ‘SRV’, ‘TXT’
  • if_match – The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwritting any concurrent changes.
  • if_none_match – Set to ‘*’ to allow a new record set to be created, but to prevent updating an existing record set. Other values will be ignored.
  • etag – The etag of the record set. Etags are used to handle concurrent changes to the same resource safely.
  • metadata – A dictionary of strings can be passed as tag metadata to the record set object.
  • ttl – The TTL (time-to-live) of the records in the record set. Required when specifying record information.
  • arecords – The list of A records in the record set. View the Azure SDK documentation to create a list of dictionaries representing the record objects.
  • aaaa_records – The list of AAAA records in the record set. View the Azure SDK documentation to create a list of dictionaries representing the record objects.
  • mx_records – The list of MX records in the record set. View the Azure SDK documentation to create a list of dictionaries representing the record objects.
  • ns_records – The list of NS records in the record set. View the Azure SDK documentation to create a list of dictionaries representing the record objects.
  • ptr_records – The list of PTR records in the record set. View the Azure SDK documentation to create a list of dictionaries representing the record objects.
  • srv_records – The list of SRV records in the record set. View the Azure SDK documentation to create a list of dictionaries representing the record objects.
  • txt_records – The list of TXT records in the record set. View the Azure SDK documentation to create a list of dictionaries representing the record objects.
  • cname_record – The CNAME record in the record set. View the Azure SDK documentation to create a dictionary representing the record object.
  • soa_record – The SOA record in the record set. View the Azure SDK documentation to create a dictionary representing the record object.
  • caa_records – The list of CAA records in the record set. View the Azure SDK documentation to create a list of dictionaries representing the record objects.
  • connection_auth – A dict with subscription and authentication parameters to be used in connecting to the Azure Resource Manager API.

Example usage:

Ensure record set exists:
    azurerm.dns.record_set.present:
        - name: web
        - zone_name: contoso.com
        - resource_group: my_rg
        - record_type: A
        - ttl: 300
        - arecords:
          - ipv4_address: 10.0.0.1
        - metadata:
            how_awesome: very
            contact_name: Elmer Fudd Gantry