terraform-provider-jamfpro
terraform-provider-jamfpro copied to clipboard
Upgrading to newer versions of extension attribute resource fails b/c of a change in `input_type`'s input type
Older versions of jamfpro_computer_extension_attribute
expected an interface for input_type
. Managing an extension attribute with older versions created Terraform state of this shape:
"type": "jamfpro_computer_extension_attribute",
"name": "device_repair_status",
"provider": "provider[\"registry.terraform.io/deploymenttheory/jamfpro\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"data_type": "Integer",
"description": "",
"enabled": true,
"id": "12",
"input_type": [
{
"choices": [
"Out for repair",
"Repaired and returned"
],
"platform": "",
"script": "",
"type": "Pop-up Menu"
}
],
intput_type
's input type is now string. Attempting to upgrade to the latest version of provider therefore generates this error:
│ Error: string is required
│
│ with jamfpro_computer_extension_attribute.device_repair_status,
│ on extension_attributes.tf line 6, in resource "jamfpro_computer_extension_attribute" "device_repair_status":
│ 6: input_type = "Pop-up Menu"
The referenced value is the new value - but the error appears to be actually caused by the state's value.
Presently, to work around this problem, I'm just re-importing my extension attributes. However, I think the optimal solution may be a state migration function for the resource. (If not feasible or a priority for this resource, its still a good for future schema changes.)