I’ve only seen mention of this once before, but unfortunately never received any follow up from that user.
I don’t think there was any way to execute an old terraform provider binary with v0.13, because that provider was built-int, but you could check the early init trace logs to make sure you are not somehow picking up an old plugin.
I think the most likely situation is that there is a state file which has not been fully upgraded, and contains a legacy representation of the remote state data. You can check the state files manually for attributes_flat objects under any remote state instances, which would explain the error given. Hopefully this is just a matter of an oversight, and refreshing the problematic state with the correct version will remedy the situation.
I have a feeling that in this case you may need to manually apply, even if there are no planned changes, or even skip refresh entirely. The error is happening during refresh in this case, so if you are sure that the rest of the resources are generally in sync, perhaps skipping the refresh will allow the data source to be re-written correctly. The separate “refresh” phase was removed in later releases, which also fixed many issues with data sources.
It sounds like we’re talking about a legacy state entry for a data resource instance here – an instance of terraform_remote_state – in which case an alternative path forward might be to ask Terraform to “forget” the previous values and thus treat this as if you’d just added that data block for the first time:
terraform state rm data.terraform_remote_state.level2_sd-wan_network
“Forgetting” a resource in this way requires some care when dealing with managed resources (those declared with resource blocks) because Terraform uses the state to remember which object it’s managing, but data resources (with data blocks) are just references to objects managed elsewhere and so just the configuration should be enough to fetch the same data, without any help from the prior state.
FWIW, this is something that ought to have been dealt with by running terraform apply while on Terraform v0.12, which had some extra logic to help upgrade over this bump. It seems like that didn’t work out for you for some reason, but it’ll be hard to debug that in retrospect and so I think it’d be better to just work around it and move forward, using one of the approaches discussed here.
as @jbardin suggested to inspect with keyword attributes_flat.
Sum up: The W/A by @apparentlymart with remote data source state rm worked.
It seems that terraform refresh cannot be used as a reliable strategy to upgrade 0.11->0.12->0.13->… and apply is strongly preferred. Unfortunately for some reasons apply cannot be blindly (massively) used in our case for an upgrade. Overall refresh side-effects could be w/a.
PS. It seems that one more refresh side-effect could be a module’s provider format ("/-/") partial update.