powerplatform_billing_policy (Resource)

Manages a Power Platform Billing Policy.

A Power Platform billing policy is a mechanism that allows you to manage the costs associated with your Power Platform usage. It's linked to an Azure subscription and is used to set up pay-as-you-go billing for an environment.

Additional Resources:

Example Usage

terraform {
  required_providers {
    powerplatform = {
      source = "microsoft/power-platform"
    }
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "4.0.1"
    }
    azurecaf = {
      source = "aztfmod/azurecaf"
    }
  }
}

provider "powerplatform" {
  use_cli = true
}

provider "azurerm" {
  features {}
  use_cli = true
}

provider "azurecaf" {
}

data "azurerm_client_config" "current" {
}

resource "azurecaf_name" "rg_example_name" {
  name          = "power-platform-billing"
  resource_type = "azurerm_resource_group"
  random_length = 5
  clean_input   = true
}

resource "azurerm_resource_group" "rg_example" {
  name     = azurecaf_name.rg_example_name.result
  location = "westeurope"
}

resource "powerplatform_billing_policy" "pay_as_you_go" {
  name     = "payAsYouGoBillingPolicyExample"
  location = "europe"
  status   = "Enabled"
  billing_instrument = {
    resource_group  = azurerm_resource_group.rg_example.name
    subscription_id = data.azurerm_client_config.current.subscription_id
  }
}

Schema

Required

  • billing_instrument (Attributes) The billing instrument of the billing policy (see below for nested schema)
  • location (String) The location of the billing policy
  • name (String) The name of the billing policy

Optional

  • status (String) The status of the billing policy (Enabled, Disabled)
  • timeouts (Attributes) (see below for nested schema)

Read-Only

  • id (String) The id of the billing policy

Nested Schema for billing_instrument

Required:

  • resource_group (String) The resource group of the billing instrument
  • subscription_id (String) The subscription id of the billing instrument

Read-Only:

  • id (String) The id of the billing instrument

Nested Schema for timeouts

Optional:

  • create (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
  • delete (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
  • read (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled.
  • update (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).