saltext.azurerm.states.azurerm_resource#

Azure Resource Manager Resource 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 resource group exists:
    azurerm_resource.resource_group_present:
        - name: my_rg
        - location: westus
        - tags:
            how_awesome: very
            contact_name: Elmer Fudd Gantry
        - connection_auth: {{ profile }}

Ensure resource group is absent:
    azurerm_resource.resource_group_absent:
        - name: other_rg
        - connection_auth: {{ profile }}

Functions

policy_assignment_absent(name, scope[, ...])

New in version 2019.2.0.

policy_assignment_present(name, scope, ...)

New in version 2019.2.0.

policy_definition_absent(name[, connection_auth])

New in version 2019.2.0.

policy_definition_present(name[, ...])

New in version 2019.2.0.

resource_group_absent(name[, connection_auth])

New in version 2019.2.0.

resource_group_present(name, location[, ...])

New in version 2019.2.0.