I was making some extensions to a terraform provider and adding in a new resource. I kept hitting the following error, which seems a little cryptic
When applying changes to resource.name, provider
│ "provider[\"name\"]" produced an
│ unexpected new value: Root resource was present, but now absent.
Part of the issues is highlighted by the plan output, terraform is expecting an “id” property to be generated by the resource.
# resource.name will be created
+ resource "resource" "name" {
+ id = (known after apply)
}
This is confirmed by an excellent write up on the details of what the error message actually means on reddit. I wasn’t calling SetId
, hence the error. Please read the reddit post for more details as there are other failure cases.