states.azurerm.network.network_interface

Azure Resource Manager (ARM) Network Interface 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.network.network_interface.absent(hub, ctx, name, resource_group, connection_auth=None, **kwargs)

New in version 1.0.0.

Ensure a network interface does not exist in the resource group.

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

Example usage:

Ensure network interface absent:
    azurerm.network.network_interface.absent:
        - name: iface1
        - resource_group: group1
idem_azurerm.states.azurerm.network.network_interface.present(hub, ctx, name, ip_configurations, subnet, virtual_network, resource_group, network_security_group=None, dns_settings=None, enable_accelerated_networking=None, enable_ip_forwarding=None, tags=None, connection_auth=None, **kwargs)

New in version 1.0.0.

Changed in version 4.0.0.

Ensure a network interface exists.

Parameters:
  • name – Name of the network interface.
  • ip_configurations – A list of dictionaries representing valid NetworkInterfaceIPConfiguration objects. The name parameter is required at minimum. At least one IP Configuration must be present.
  • subnet – Name of the existing subnet assigned to the network interface.
  • virtual_network – Name of the existing virtual network containing the subnet.
  • resource_group – The resource group assigned to the virtual network.
  • network_security_group – The name of the existing network security group to assign to the network interface.
  • dns_settings

    A dictionary representing a valid NetworkInterfaceDnsSettings object. Valid parameters are:

    • dns_servers: List of DNS server IP addresses. Use ‘AzureProvidedDNS’ to switch to Azure provided DNS resolution. ‘AzureProvidedDNS’ value cannot be combined with other IPs, it must be the only value in dns_servers collection.
    • internal_dns_name_label: Relative DNS name for this NIC used for internal communications between VMs in the same virtual network.
  • enable_accelerated_networking – A boolean indicating whether accelerated networking should be enabled for the interface.
  • enable_ip_forwarding – A boolean indicating whether IP forwarding should be enabled for the interface.
  • tags – A dictionary of strings can be passed as tag metadata to the network interface object.
  • connection_auth – A dict with subscription and authentication parameters to be used in connecting to the Azure Resource Manager API.

Example usage:

Ensure network interface exists:
    azurerm.network.network_interface.present:
        - name: iface1
        - subnet: vnet1_sn1
        - virtual_network: vnet1
        - resource_group: group1
        - ip_configurations:
          - name: iface1_ipc1
            public_ip_address: pub_ip2
        - dns_settings:
            internal_dns_name_label: decisionlab-int-test-label
        - enable_accelerated_networking: True
        - enable_ip_forwarding: False
        - network_security_group: nsg1