Terraform Provider developement – Root resource was present, but now absent

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.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: