Closed ozbillwang closed 7 years ago
Thanks for the report, @ozbillwang.
It would be helpful if you could provide the output from Terraform (or a snippet) that caused this so we can easily reproduce. Ideally you would run terraform plan > output.txt
and then provide an output.txt
that reproduces the issue with cat output.txt | landscape
. Thanks!
@sds
Thanks. The problem is for any tf files if run with terraform v0.10.0
For example, you can create a new main.tf
as below
$ mkdir new_folder
$ cd new_folder
# Create a simple tf file as below.
$ cat main.tf
provider "aws" {
version = "~> 0.1"
region = "ap-southeast-2"
}
resource "aws_s3_bucket" "b" {
bucket = "my_tf_test_bucket"
acl = "private"
tags {
Name = "My bucket"
Environment = "Dev"
}
}
$ terraform init
$ terraform plan |landscape
error: Output does not contain proper preface. Use --trace to view backtrace
I also upload the output file you asked for with command terraform plan > output.txt
This issue seems to be related to the lack of -out
flag provided in your particular example. Fixed by #25 but let us know if that still doesn't work!
Looks not fix.
error: Expected one of '~', '-/+', '-', '+', '<=', "\n" at line 46, column 1 (byte 3020) after . Use --trace to view backtrace
The trace details:
+ terraform plan -var-file=dev.tfvars
+ landscape --trace
/usr/local/lib/ruby/gems/2.4.0/gems/terraform_landscape-0.1.8/lib/terraform_landscape/terraform_plan.rb:36:in `from_output': Expected one of '~', '-/+', '-', '+', '<=', "\n" at line 71, column 1 (byte 4577) after (TerraformLandscape::TerraformPlan::ParseError)
from /usr/local/lib/ruby/gems/2.4.0/gems/terraform_landscape-0.1.8/lib/terraform_landscape/printer.rb:59:in `process_string'
from /usr/local/lib/ruby/gems/2.4.0/gems/terraform_landscape-0.1.8/lib/terraform_landscape/printer.rb:35:in `process_stream'
from /usr/local/lib/ruby/gems/2.4.0/gems/terraform_landscape-0.1.8/lib/terraform_landscape/cli.rb:48:in `print'
from /usr/local/lib/ruby/gems/2.4.0/gems/terraform_landscape-0.1.8/lib/terraform_landscape/cli.rb:34:in `block (2 levels) in define_commands'
from /Users/bill.wang/.gem/ruby/2.4.0/gems/commander-4.4.3/lib/commander/command.rb:178:in `call'
from /Users/bill.wang/.gem/ruby/2.4.0/gems/commander-4.4.3/lib/commander/command.rb:153:in `run'
from /Users/bill.wang/.gem/ruby/2.4.0/gems/commander-4.4.3/lib/commander/runner.rb:446:in `run_active_command'
from /Users/bill.wang/.gem/ruby/2.4.0/gems/commander-4.4.3/lib/commander/runner.rb:68:in `run!'
from /Users/bill.wang/.gem/ruby/2.4.0/gems/commander-4.4.3/lib/commander/delegates.rb:15:in `run!'
from /usr/local/lib/ruby/gems/2.4.0/gems/terraform_landscape-0.1.8/lib/terraform_landscape/cli.rb:25:in `run'
from /usr/local/lib/ruby/gems/2.4.0/gems/terraform_landscape-0.1.8/bin/landscape:7:in `<top (required)>'
from /usr/local/bin/landscape:22:in `load'
from /usr/local/bin/landscape:22:in `<main>'
I can't provide the company's configuration files, will do some updates and paste here.
All we need is a minimal example that reproduces the issue, @ozbillwang. Your previous example failed for a different reason (but was still a bug, so we definitely appreciate you providing it).
Again, the fastest way to get this fixed is to give us a simple output that when we run cat output | landscape
allows us to reproduce the issue.
We're not currently using Terraform 0.10 so would really appreciate the help here. Thanks!
For me, this error is generated when there are no changes to be made. The plan
runs fine, but not the apply
.
Terraform Version: 0.11.7 Landscape Version: 0.1.18
Any terraform script that ends up with errors so that execution is aborted before terraform outputs
------------------------------------------------------------------------
An execution plan has been generated and is shown below
I do not know exactly what output is expected by landscape, but any script I've tried that stopped short of the above would fail. On the other hand, any script that includes the above also results in additional output.
Easiest way to reproduce the landscape issue $ echo "" | landscape Expected: No error message from landscape Actual: error: Output does not contain proper preface. Use --trace to view backtrace
It would make sense to see only stdout/stderr from terraform. Getting error messages from landscape in this case just adds confusion, especially considering that it's not immediately clear if the landscape error output came from terraform or landscape.
Environment
Terraform version: 0.10.0 Run on macbook with terraform binary. Didn't test within container.
Error:
trace: