Open naikajah opened 3 months ago
Hi @naikajah , thanks for submitting this! The subscription id of azurerm_maintenance_assignment_dynamic_scope
is inherited from the provider block. Can you try with the provider alias feature, e.g.,
provider "azurerm" {
alias = "sub2"
subscription_id = "<sub2-id>"
}
resource "azurerm_maintenance_assignment_dynamic_scope" "example" {
provider = azurerm.sub2
name = "example"
maintenance_configuration_id = azurerm_maintenance_configuration.example.id
...
}
@teowa Yes, that approach could work. However, my requirements are slightly different. I have a YAML configuration file for the Azure Update Manager, which includes multiple dynamic scopes tailored for various projects utilizing the module. The YAML configuration specifies Subscription Aliases instead of Subscription IDs. Therefore, I need to extract the subscription alias from the YAML and convert it to the Subscription ID to set it as the parentID.
Using provider blocks might necessitate multiple provider blocks unless I completely redesign the solution.
Is there an existing issue for this?
Community Note
Terraform Version
1.9.2
AzureRM Provider Version
3.112.0
Affected Resource(s)/Data Source(s)
azurerm_maintenance_assignment_dynamic_scope
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
Dynamic Scope should be allowed to set up the target Subscription Scope.
Actual Behaviour
Always sets the scope as the current subscription's context from where the terraform is run.
Steps to Reproduce
No response
Important Factoids
NA
References
https://learn.microsoft.com/en-us/azure/templates/microsoft.maintenance/configurationassignments?pivots=deployment-language-terraform