Cryptic error "Error: value is not known"

I’m upgrading a config to 0.12 and I get this error:

Error: value is not known

In DEBUG output I see this:

2019/07/24 13:32:57 [DEBUG] ReferenceTransformer: “module.service-user.aws_iam_user_group_membership.groups[0]” references:
2019/07/24 13:32:57 [TRACE] Completed graph transform *terraform.ReferenceTransformer (no changes)
2019/07/24 13:32:57 [TRACE] Executing graph transform *terraform.RootTransformer
2019/07/24 13:32:57 [ERROR] module.service-user: eval: *terraform.EvalReadState, err: value is not known
2019/07/24 13:32:57 [ERROR] module.service-user: eval: *terraform.EvalSequence, err: value is not known
2019/07/24 13:32:57 [TRACE] [walkRefresh] Exiting eval tree: module.service-user.aws_iam_user_group_membership.groups[0]
2019/07/24 13:32:57 [TRACE] vertex “module.service-user.aws_iam_user_group_membership.groups[0]”: visit complete

I can’t seem to figure out what is going on with it and whether it is something goofy 0.12 reading the existing state file or something goofy with my module. “value is not known” is pretty much a useless error.

Hi @grimm26!

Could you show exactly what command you are running and the full output it’s generating that includes that error message? It seems that some “should never happen” situation is happening here, and thus there’s no proper error-handling codepath for it; seeing what exactly you were running should help narrow down what that could be.

I ended up removing module.service-user from the state and importing it again so I could move on. That worked. I had some info about this saved, but it was in /tmp and my computer rebooted overnight for some reason. I have more state files that use this module that I still have to upgrade so I’ll see if it happens again.

I was just trying to run an apply after updating that directory and the modules that it used to tf12 syntax.