hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.6k stars 4.64k forks source link

azurerm_resources data source does not support type "Microsoft.Consumption/budgets" ("Microsoft.Resources/resourceGroups") #9964

Open gro1m opened 3 years ago

gro1m commented 3 years ago

Community Note

Terraform (and AzureRM Provider) Version

Terraform v0.13.3

Affected Resource(s)

Terraform Configuration Files

provider azurerm {
  features {}
}

data "azurerm_resources" "test" {
  resource_group_name = "test-rg"
  type = "Microsoft.Consumption/budgets"
}

output "budget" {
  value = data.azurerm_resources.test
}

Debug Output

budget = { "id" = "resource-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" "resource_group_name" = "test-rg" "resources" = [] "type" = "Microsoft.Consumption/budgets" }

Panic Output

Expected Behaviour

Should have listed the budget resource, i.e. the resources field should not be empty.

Actual Behaviour

The resources field is empty

Steps to Reproduce

  1. terraform apply or
  2. terraform plan

As a sidenote, there also seems no possibility to retrieve information on resource groups, e.g. tags, as using the azurerm_resource_group data source runs into this issue: https://github.com/hashicorp/terraform/issues/16380. Therefore it would also be nice if a type "Microsoft.Resources/resourceGroups" would be allowed here, but I am not sure if this is even possible or excluded by design.

Xat59 commented 2 years ago

I have the same behavior with Microsoft.RecoveryServices resource type :

data "azurerm_resources" "rs" {
  type                = "Microsoft.RecoveryServices"
}

output "rs" {
  value = data.azurerm_resources.rs
}

Here is the output :

rs = {
  "id" = "resource-4761bd34-dfa7-4e37-b3a6-45a4127221cb"
  "resources" = []
  "type" = "Microsoft.RecoveryServices"
}

Note that I have an existing Azure SIte Recovery . Thanks