v9.0.0 upgrade fails with "missing expected [" due to missing state migration for bot_management
## Description
Upgrading from v8.x to v9.0.0 fails with `missing expected [` during `terraform plan`.
The breaking change in v9.0.0 changed `product_enablement.bot_management` from boolean to Block List, but no `StateUpgraders` was provided to migrate existing state.
## Steps to reproduce
1. Have a `fastly_service_vcl` resource with `product_enablement` managed by v8.x
2. Upgrade provider to v9.0.0
3. Run `terraform plan`
## Error
```
Error: missing expected [
with module.fastly_service.fastly_service_vcl.this,
on ../modules/fastly_service/main.tf line 16, in resource "fastly_service_vcl" "this":
16: resource "fastly_service_vcl" "this" {
```
On Terraform Cloud, `terraform plan` itself succeeds (0 changes), but plan JSON generation fails:
```
Failed to marshal plan to json: error marshaling prior state: missing expected [
```
## Cause
Existing state (created by v8.x) has `bot_management` as a boolean:
```json
"product_enablement": [
{
"bot_management": false,
"brotli_compression": true,
"ddos_protection": [],
"ngwaf": [],
"origin_inspector": true,
...
}
]
```
v9.0.0 expects `bot_management` as a Block List (`[]`), not a boolean (`false`).
## Expected behavior
The provider should include a `StateUpgrader` to migrate `bot_management` from boolean to Block List format when upgrading from v8.x to v9.0.0.
## Versions
- Terraform: v1.10.4
- Provider: v9.0.0 (upgraded from v8.x)
2 条评论