Skip to content

Latest commit

 

History

History
56 lines (38 loc) · 3.41 KB

File metadata and controls

56 lines (38 loc) · 3.41 KB

Introduction

Consumption Budget module can deploy these resources:

  • azurerm_consumption_budget_management_group (optional)
  • azurerm_consumption_budget_resource_group (optional)
  • azurerm_consumption_budget_subscription (optional)

NOTE: At least one of these needs to be specified in module configuration

Example variables structure is located in variables.md.

Example use case is located in test-case/locals.tf.

You can also see changelog.

Terraform documentation:

https://registry.terraform.io/providers/hashicorp/azurerm/4.1.0/docs/resources/consumption_budget_management_group

https://registry.terraform.io/providers/hashicorp/azurerm/4.1.0/docs/resources/consumption_budget_resource_group

https://registry.terraform.io/providers/hashicorp/azurerm/4.1.0/docs/resources/consumption_budget_subscription

WARNING: AzureRM provider had been updated to a new major version. Many breaking changes were implemented. See the providers guide for more information.

 

Terraform Import

There are a few things you need to do to import resources into .tfstate. In the example below there are resources which can be imported within the module. You may need to modify these commands to the OS on which they will be running (Refer to the documentation for additional details).

Consumption Budget Management Group

  • terraform import '<path-to-module>.azurerm_consumption_budget_management_group.consumption_budget_management_group["<consumption-budget-management-group-name>"]' '/providers/Microsoft.Management/managementGroups/<management-group-name>/providers/Microsoft.Consumption/budgets/<consumption-budget-management-group-name>'

Consumption Budget Resource Group

  • terraform import '<path-to-module>.azurerm_consumption_budget_resource_group.consumption_budget_resource_group["<consumption-budget-resource-group-name>"]' '/subscriptions/<subscription-id>/resourceGroups/<consumption-budget-resource-group-name>/providers/Microsoft.Consumption/budgets/<consumption-budget-resource-group-name>'

Consumption Budget Subscription

  • terraform import '<path-to-module>.azurerm_consumption_budget_subscription.consumption_budget_subscription["<consumption-budget-subscription-name>"]' '/subscriptions/<subscription-id>/providers/Microsoft.Consumption/budgets/<consumption-budget-subscription-name>'

NOTE: <path-to-module> is terraform logical path from root. e.g. module.consumption_budget

 

Outputs

Structure

Output Name Value Comment
outputs name
id

 

Module Features

management_group_id, resource_group_id, or subscription_id

This module can be deployed at either the management group, resource group or subscription scope. The module will automatically determine which scope it is being deployed at based on the variables you configure. Resource Group scope needs one extra custom variable, resource_group_name, to be specified for the deployment to work. See test-case/locals.tf for an example of how to deploy at different levels.

 

Known Issues

We currently log no issues in this module.