saltext.azurerm.states.azurerm_compute#

Azure Resource Manager Compute State Module

New in version 2019.2.0.

maintainer:

<devops@eitr.tech>

maturity:

new

platform:

linux

configuration:

This module requires Azure Resource Manager credentials to be passed as a dictionary of keyword arguments to the connection_auth parameter in order to work properly. Since the authentication parameters are sensitive, it’s recommended to pass them to the states via pillar.

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 Pillar for Azure Resource Manager authentication:

azurerm:
    user_pass_auth:
        subscription_id: 3287abc8-f98a-c678-3bde-326766fd3617
        username: fletch
        password: 123pass
    mysubscription:
        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

Example states using Azure Resource Manager authentication:

{% set profile = salt['pillar.get']('azurerm:mysubscription') %}
Ensure availability set exists:
    azurerm_compute.availability_set_present:
        - name: my_avail_set
        - resource_group: my_rg
        - virtual_machines:
            - my_vm1
            - my_vm2
        - tags:
            how_awesome: very
            contact_name: Elmer Fudd Gantry
        - connection_auth: {{ profile }}

Ensure availability set is absent:
    azurerm_compute.availability_set_absent:
        - name: other_avail_set
        - resource_group: my_rg
        - connection_auth: {{ profile }}

Functions

availability_set_absent(name, resource_group)

New in version 2019.2.0.

availability_set_present(name, resource_group)

New in version 2019.2.0.