From 5a14e64c6adde81ac197f95d737907bc2efc6c88 Mon Sep 17 00:00:00 2001 From: Rafael Weingartner-Ortner <38643099+RafaelWO@users.noreply.github.com> Date: Wed, 26 Nov 2025 18:28:29 +0100 Subject: [PATCH] Fix parsing of new blocks in state This change fixes the parsing of a Terraform state by only creating new blocks if the line starts with `# ` - note the space after the hash. This is required because the state can contain arbitrary data, e.g. the raw content of a file (from `data.local_file`, which can start with a `#` - this is what happened in my case. I hope that hash + whitespace will only occur if a new block starts. --- tftui/state.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tftui/state.py b/tftui/state.py index be727f1..959a272 100644 --- a/tftui/state.py +++ b/tftui/state.py @@ -107,7 +107,7 @@ async def refresh_state(self) -> None: contents = "" for line in state_output: - if line.startswith("#"): + if line.startswith("# "): (fullname, name, submodule, type, is_tainted) = State.parse_block(line) contents = "" elif line.startswith("}"):