-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
azurerm_subscription workload parameter 'does not match config value' #11232
Comments
To get it to work we commented the lines 90-92 in the file '~/terraform-provider-azurerm/azurerm/internal/services/subscription/subscription_resource.go' and used the locally compiled provider for testing. 89 // Workload is not exposed in any way, so must be ignored if the resource is imported.
90 //DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
91 // return old == ""
92 //}, After which the plan did not suppress the 'workload' parameter anymore and the subscription was created using the 'DevTest' workload. An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# module.components.azurerm_subscription.azureSubscription will be created
+ resource "azurerm_subscription" "azureSubscription" {
+ alias = (known after apply)
+ billing_scope_id = "/providers/Microsoft.Billing/billingAccounts/<BILLING_ACCOUNT>/enrollmentAccounts/<ENROLLMENT_ACCOUNT>"
+ id = (known after apply)
+ subscription_id = (known after apply)
+ subscription_name = "testsub_local"
+ tags = (known after apply)
+ tenant_id = (known after apply)
+ workload = "DevTest"
}
Plan: 1 to add, 0 to change, 0 to destroy. Could you please look into this, since we are unable to fully comprehend the purpose of this piece of code. |
Using the locally compiled provider the replacement of the previously created subscription using the official provider gave the following output: module.components.azurerm_subscription.azureSubscription: Refreshing state... [id=/providers/Microsoft.Subscription/aliases/<SUBSCRIPTION_ALIAS>]
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement
Terraform will perform the following actions:
# module.components.azurerm_subscription.azureSubscription must be replaced
-/+ resource "azurerm_subscription" "azureSubscription" {
~ alias = "<SUBSCRIPTION_ALIAS>" -> (known after apply)
~ id = "/providers/Microsoft.Subscription/aliases/<SUBSCRIPTION_ALIAS>" -> (known after apply)
~ subscription_id = "<SUBSCRIPTION_ID>" -> (known after apply)
~ tags = {} -> (known after apply)
~ tenant_id = "<TENANT_ID>" -> (known after apply)
+ workload = "DevTest" # forces replacement
# (2 unchanged attributes hidden)
}
Plan: 1 to add, 0 to change, 1 to destroy. Apparently the workload parameter was not used at all even though by my understanding of the documentation it should be set with "Production" as the default if not otherwise provided. |
Thanks for raising this, we were previously unable to test DevTest subscriptions so this was something of a blind-spot. For info - the DiffSuppress is to help avoid diffs in edge cases, such as in Subscriptions where the workload property value is not readable from the API, and since it cannot be changed we needed to avoid this triggering a force new. In the case here it was unintentionally suppressing all values, meaning we always took the default. The PR above resolves this and I have successfully created a DevTest subscription. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Terraform (and AzureRM Provider) Version
Terraform v0.14.9
Affected Resource(s)
azurerm_subscription
- workloadTerraform Configuration Files
Expected Behaviour
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/subscription#workload
Terraform plan shows the provided workload parameter.
Subscription will be created using the provided (in this case "DevTest") workload.
Actual Behaviour
Subscription is created using the "Production" workload.
Terraform plan does not display the workload parameter at all:
Terraform plan using the trace parameter gives the following output:
We tested the workload parameter with "Production" aswell with the same behaviour in the plan and debug output.
Steps to Reproduce
terraform plan/apply
The text was updated successfully, but these errors were encountered: