dmlittle/scenery

Parsing fails when plan metadata is missing a newline

Closed this issue · 4 comments

I've been running into a few instances where scenery fails to parse my plans, and I've narrowed it down to a missing new line before the Metadata. Example:

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create
  ~ update in-place

Terraform will perform the following actions:

+ local_file.config
      id:                <computed>
      filename:          "config.yaml"  
Plan: 1 to add, 1 to change, 0 to destroy.

If I add a newline before Plan: 1 to add..., it works. It seems that terraform will randomly skip that newline when generating plans. I'm using terraform 0.11.13.

@kenske thanks for reporting this issue. It's weird that terraform sometimes includes that new line and sometimes it does not.

I have some time this weekend to take a look and fix this issue. Do you have any idea as to when Terraform includes (or not) the newline right before the Plan: 1 to add... line?

@dmlittle I haven't been able to find a pattern. Looking into the terraform source code, it doesn't appear to insert a newline before that string, so it seems it's dependent on whether the last change ends with a newline or not:

https://github.com/hashicorp/terraform/blob/b9d8e96e0c7c52487e45eaab1aa6dacc39997b47/backend/local/backend_plan.go#L290

@kenske a fix for this is available in v0.1.4

If you installed the scenery using go get you can run go get -u github.com/dmlittle/scenery to update your version

@dmlittle Awesome! Thanks so much.