You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
data.azurerm_automation_variable_string.test_variable: Reading...
2023-06-08T13:53:53.313+0300 [DEBUG] provider.terraform-provider-azurerm_v3.59.0_x5: AzureRM Request:
GET /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Automation/automationAccounts/testaccount/variables/my_variable?api-version=2020-01-13-preview HTTP/1.1
[...]
2023-06-08T13:53:58.177+0300 [DEBUG] provider.terraform-provider-azurerm_v3.59.0_x5: AzureRM Response for https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Automation/automationAccounts/testaccount/variables/my_variable?api-version=2020-01-13-preview#test:
HTTP/2.0 404 Not Found
[...]
{"code":"NotFound","message":"Variable not found."}: timestamp=2023-06-08T13:53:58.177+0300
2023-06-08T13:53:58.227+0300 [INFO] provider.terraform-provider-azurerm_v3.59.0_x5: Automation String Variable "" does not exist - removing from state: timestamp=2023-06-08T13:53:58.226+0300
Expected Behaviour
The provider should return correct value regardless of variable name
Actual Behaviour
The provider searches for the wrong variable if its name contains '#' (according to Azure specification variable name can contain '#'). Ex. if the variable name is 'my_variable#test', the provider tries to read variable with name 'my_variable'.
Steps to Reproduce
Create automation account 'testaccount'
Add variable 'my_variable#test' with any value
Run terraform apply
Important Factoids
No response
References
No response
The text was updated successfully, but these errors were encountered:
@kandelk thanks for filing this issue. as the name of a variable resource is part of the URL when create/get the resource, so the # will be parsed as the fragment part of the URL and it makes the provider request a wrong URL, which means it read a varibale name as my_variable instead of my_variable#test.
just for curiouse how did you create a variable name like my_variable#test, because i can't create such variable in Azure Portal neither:
@wuxu92 Thanks for your help. I also can't create such variable in the portal.
I created the variable using terraform with azurerm provider version 3.44.1.
This is a code example that works for me:
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.44.1"
}
}
}
provider "azurerm" {
features {}
}
resource "azurerm_automation_variable_string" "test_variable" {
name = "my_variable#test"
resource_group_name = "test-rg"
automation_account_name = "testaccount"
value = "test_value"
}
@kandelk PR #20568 moved to a new SDK version with a different logic from the old Azure SDK. Is this required feature to support # in a variable name, because it's not supported in the Azure Portal either, I guess AzureRM should not keep it too.
Is there an existing issue for this?
Community Note
Terraform Version
1.4.6
AzureRM Provider Version
3.59.0
Affected Resource(s)/Data Source(s)
azurerm_automation_variable_string
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
The provider should return correct value regardless of variable name
Actual Behaviour
The provider searches for the wrong variable if its name contains '#' (according to Azure specification variable name can contain '#'). Ex. if the variable name is 'my_variable#test', the provider tries to read variable with name 'my_variable'.
Steps to Reproduce
Important Factoids
No response
References
No response
The text was updated successfully, but these errors were encountered: