Open pinlast opened 1 year ago
Hi @pinlast, thank you for reaching out.
Could you kindly check the value of subscription_id
in azurerm_subscription_cost_management_export
? The valid format of subscription_id
should be /subscriptions/00000000-0000-0000-0000-000000000000
.
@ms-zhenhua
│ Error: parsing "3003b46d-a543-438d-9bd8-fc8f3ad03bd2": parsing the Subscription ID: the number of segments didn't match
│
│ Expected a Subscription ID that matched (containing 2 segments):
│
│ > /subscriptions/12345678-1234-9876-4563-123456789012
│
│ However this value was provided (which was parsed into 0 segments):
│
│ > 3003b46d-a543-438d-9bd8-fc8f3ad03bd2
resource "azurerm_subscription" "sub" {
subscription_name = var.subscription_name
billing_scope_id = var.billing_scope_id
}
resource "azurerm_subscription_policy_assignment" "namespace_tag" {
name = "namespace_tag"
subscription_id = azurerm_subscription.sub.subscription_id
policy_definition_id = data.azurerm_policy_definition.add_or_replace_tag_on_subscription.id
parameters = jsonencode({
"tagName" : {
"value" : "NameSpace",
}
"tagValue" : {
"value" : var.finops_tags.NameSpace,
}
})
description = "Set NameSpace tag for subscription"
}
related to this bug: https://github.com/hashicorp/terraform-provider-azurerm/issues/13422
Is there an existing issue for this?
Community Note
Terraform Version
1.4.6
AzureRM Provider Version
3.54.0
Affected Resource(s)/Data Source(s)
azurerm_subscription_cost_management_export
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
resource azurerm_subscription_cost_management_export should be created
Actual Behaviour
azurerm_subscription_cost_management_export resource can't be created because subscription id is expected to have 2 segments
Steps to Reproduce
No response
Important Factoids
No response
References
There is same issue, but fix doesn't work for me https://github.com/hashicorp/terraform-provider-azurerm/issues/21241