When importing an azuread_access_package_assignment_policy resource containing multiple choice questions, it errors with:
│ Error: Retrieving access package assignment policy with object ID: "b4118c2f-5ccc-434e-a5bf-5335d1595cf5"
│
│ json.Unmarshal(): json: invalid use of ,string struct tag, trying to unmarshal "Yes" into string
Full example output
```text
> terraform plan
var.tenant_id
Microsoft Entra Tenant ID
Enter a value: XXXXXXXXXXXXXXXXX
azuread_access_package.example_package: Preparing import... [id=d4300416-ec6c-4b5c-b7a7-71c54bed555c]
azuread_access_package_catalog.example_catalog: Preparing import... [id=c018eef6-34df-4edc-9f24-ba35f1c80a2e]
azuread_access_package_catalog.example_catalog: Refreshing state... [id=c018eef6-34df-4edc-9f24-ba35f1c80a2e]
azuread_access_package.example_package: Refreshing state... [id=d4300416-ec6c-4b5c-b7a7-71c54bed555c]
azuread_access_package_assignment_policy.example_policy: Preparing import... [id=b4118c2f-5ccc-434e-a5bf-5335d1595cf5]
azuread_access_package_assignment_policy.example_policy: Refreshing state... [id=b4118c2f-5ccc-434e-a5bf-5335d1595cf5]
Terraform planned the following actions, but then encountered a problem:
# azuread_access_package.example_package will be imported
resource "azuread_access_package" "example_package" {
catalog_id = "c018eef6-34df-4edc-9f24-ba35f1c80a2e"
description = "An example access package"
display_name = "My Access Package"
hidden = false
id = "d4300416-ec6c-4b5c-b7a7-71c54bed555c"
}
# azuread_access_package_catalog.example_catalog will be imported
resource "azuread_access_package_catalog" "example_catalog" {
description = "An example catalog for testing access packages"
display_name = "Example Catalog"
externally_visible = false
id = "c018eef6-34df-4edc-9f24-ba35f1c80a2e"
published = true
}
Plan: 2 to import, 0 to add, 0 to change, 0 to destroy.
╷
│ Error: Retrieving access package assignment policy with object ID: "b4118c2f-5ccc-434e-a5bf-5335d1595cf5"
│
│ json.Unmarshal(): json: invalid use of ,string struct tag, trying to unmarshal "Yes" into string
╵
```
Community Note
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritise this request
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritise the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform (and AzureAD Provider) Version
Terraform v1.9.0
on windows_amd64
+ provider registry.terraform.io/hashicorp/azuread v2.53.1
When importing an
azuread_access_package_assignment_policy
resource containing multiple choice questions, it errors with:Full example output
```text > terraform plan var.tenant_id Microsoft Entra Tenant ID Enter a value: XXXXXXXXXXXXXXXXX azuread_access_package.example_package: Preparing import... [id=d4300416-ec6c-4b5c-b7a7-71c54bed555c] azuread_access_package_catalog.example_catalog: Preparing import... [id=c018eef6-34df-4edc-9f24-ba35f1c80a2e] azuread_access_package_catalog.example_catalog: Refreshing state... [id=c018eef6-34df-4edc-9f24-ba35f1c80a2e] azuread_access_package.example_package: Refreshing state... [id=d4300416-ec6c-4b5c-b7a7-71c54bed555c] azuread_access_package_assignment_policy.example_policy: Preparing import... [id=b4118c2f-5ccc-434e-a5bf-5335d1595cf5] azuread_access_package_assignment_policy.example_policy: Refreshing state... [id=b4118c2f-5ccc-434e-a5bf-5335d1595cf5] Terraform planned the following actions, but then encountered a problem: # azuread_access_package.example_package will be imported resource "azuread_access_package" "example_package" { catalog_id = "c018eef6-34df-4edc-9f24-ba35f1c80a2e" description = "An example access package" display_name = "My Access Package" hidden = false id = "d4300416-ec6c-4b5c-b7a7-71c54bed555c" } # azuread_access_package_catalog.example_catalog will be imported resource "azuread_access_package_catalog" "example_catalog" { description = "An example catalog for testing access packages" display_name = "Example Catalog" externally_visible = false id = "c018eef6-34df-4edc-9f24-ba35f1c80a2e" published = true } Plan: 2 to import, 0 to add, 0 to change, 0 to destroy. ╷ │ Error: Retrieving access package assignment policy with object ID: "b4118c2f-5ccc-434e-a5bf-5335d1595cf5" │ │ json.Unmarshal(): json: invalid use of ,string struct tag, trying to unmarshal "Yes" into string ╵ ```Community Note
Terraform (and AzureAD Provider) Version
Affected Resource(s)
azuread_access_package_assignment_policy
Terraform Configuration Files
Debug Output
Available on request.
Expected Behavior
The resource should import without any errors.
Actual Behavior
It errors, see above.
Steps to Reproduce
Create an access package assignment policy with multiple choice questions, for example:
Graph API (beta) data - trimmed to `questions` section only
```json "questions": [ { "@odata.type": "#microsoft.graph.accessPackageMultipleChoiceQuestion", "id": "71721dd4-5fd1-4018-9164-e75282feadc2", "isRequired": false, "isAnswerEditable": null, "text": "Are you sure?", "sequence": 0, "isMultipleSelectionAllowed": false, "localizations": [], "choices": [ { "text": "Yes", "actualValue": "Yes", "localizations": [ { "text": "Yes", "languageCode": "en-GB" } ] }, { "text": "No", "actualValue": "No", "localizations": [ { "text": "No", "languageCode": "en-GB" } ] } ] } ], ```Import this assignment policy (see code above).
Run
terraform plan
Important Factoids
References
N/A