idoavrah / terraform-tui

Terraform textual UI
https://pypi.org/project/tftui/
Apache License 2.0
998 stars 30 forks source link

Failed to marshal state to json: unsupported attribute #29

Closed marcleblanc2 closed 10 months ago

marcleblanc2 commented 1 year ago

What happens:

Executing tftui results in early exit during startup.

The TUI loads, and shows: Executing Terraform init Executing Terraform show

image

Then exits, with the message unsupported attribute "http_protocol_ipv6" and prints my Terraform state

This was on Terraform CLI v1.3.5, I upgraded it to v1.5.5, tftui still exits after Executing Terraform show, the error message is a little longer: Failed to marshal state to json: unsupported attribute "http_protocol_ipv6" but it doesn't print my Terraform state I checked my Terraform state, and this appears to be an attribute of an aws_instance, under metadata_options

I tried switching to another Terraform repo, tftui exits early there too, this time with: Failed to marshal state to json: unsupported attribute "secondary_allocation_ids" I checked my Terraform state, and this appears to be an attribute of an aws_nat_gateway

Versions: tftui v0.4.2 Installed via pip install tftui macOS 13.5 (22G74) M1 Max Python 3.11.2 Terraform CLI v1.3.5 and v1.5.5 My Terraform state is stored remotely on Terraform Cloud, but tftui / terraform CLI is able to read the state

What I'd like to happen:

Steps to Reproduce:

idoavrah commented 10 months ago

Those two error messages are originated in the terraform command itself. Looks like a known bug, you first need to fix the state. Also, consider upgrading your terraform cli version.

https://github.com/hashicorp/terraform-provider-aws/issues/31637

marcleblanc2 commented 10 months ago

Thank you for your help @idoavrah!

The cause of the issue for me is that the AWS Terraform Provider and Terraform CLI on my laptop were a few versions behind the provider and binary used on Terraform Cloud (latest), so I had to run:

brew upgrade terraform
terraform init -upgrade

I also ran a refresh-only Terraform apply via the TFC web UI, I'm not sure if that was required.