Can I use InfraMap with OpenTofu?

51 Views Asked by At

I'm trying to use InfraMap with OpenTofu. When I run:

tofu show -json | inframap generate

I got the following error:

"Error: error while validating TFStateVersion: could not read version 0: invalid Terraform State version, we only support version 3 and 4"

Any ideas on how to address this?

1

There are 1 best solutions below

1
nmishin On BEST ANSWER

Looks like this is not related to OpenTofu, I have the same issue with the last one Terraform version (1.6.6).

My state file contain some resources, I cleaned them up for security. Clean state looks like:

cat terraform.tfstate
{
  "version": 4,
  "terraform_version": "1.6.6",
  "serial": 19,
  "lineage": "0fcc9f92-5e79-c93c-0ad2-3cdfa88db5eb",
  "outputs": {},
  "resources": [],
  "check_results": null
}

I could get some resources from state via inframap generate --clean=false terraform.tfstate but looks like some bug in inframap itself.

The closest issue on GitHub that I could find is this: https://github.com/cycloidio/inframap/issues/136