Resources left in state JSON after "terraform state rm" but with no instances?

Hi,
I deleted about 20 resources manually from a state that has about 5000 resources. The resources are now gone, which is shown here:

$ terraform state list | grep kong
$

But I still see the resources in the state JSON, which is interesting:

$ terraform state pull > state.json
$ grep kong state.json
      "name": "burst_balance-kong",
      "name": "high_cpu_utilization-kong",
      "name": "high_db_connections-kong",
      "name": "high_disk_queue_depth-kong",
      "name": "high_maximum_used_transaction_ids-kong",
      "name": "high_read_iops-kong",
      "name": "low_cpu_credit_balance-kong",
      "name": "low_free_storage_space-kong",
      "name": "low_freeable_memory-kong",
      "module": "module.rds-kong",
      "module": "module.rds-kong",
      "module": "module.rds-kong",
      "module": "module.rds-kong",
      "module": "module.rds-kong",

If I select some of them, I see they have no instances:

$ cat state.json | jq '.resources[] | select(.name=="low_free_storage_space-kong")'
{
  "mode": "managed",
  "type": "aws_cloudwatch_metric_alarm",
  "name": "low_free_storage_space-kong",
  "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
  "instances": []
}

Is this normal? Is this every cleaned up? It’s terraform version 0.14.

The state you have here is expected for version v0.14, since only the instances were removed at that time. I believe current releases will also now clean up the empty resource objects during state rm.

OK very interesting. Thanks @jbardin!