boltops-tools / terraspace

Terraspace: The Terraform Framework
https://terraspace.cloud
Apache License 2.0
674 stars 46 forks source link

Terraspace errors when deprecation warning in single stack when using terraspace all plan #231

Closed exoaturner closed 2 years ago

exoaturner commented 2 years ago

Checklist

My Environment

Software Version
Operating System Ubuntu 20.04
Terraform v1.1.7
Terraspace 1.1.7
Ruby 2.7.0p0

Expected Behaviour

Not really 100% sure on the expected behavior, as there are use cases for failing on deprecation warning but there is no bypass. This makes working with the old AWS provider hard while waiting for the new one to mature or have bugs resolved.

Current Behavior

The terraspace all plan fails on deprecation warning but terraspace plan stack doesn't.

Error message:

/home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/cli/logs/concern.rb:21:in `match': invalid byte sequence in US-ASCII (ArgumentError)
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/cli/logs/concern.rb:21:in `match'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/cli/logs/concern.rb:21:in `pid'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/cli/logs/concern.rb:7:in `block in readlines'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/cli/logs/concern.rb:6:in `each'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/cli/logs/concern.rb:6:in `find'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/cli/logs/concern.rb:6:in `readlines'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/all/summary.rb:15:in `run'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/all/runner.rb:117:in `block in summarize'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/all/runner.rb:110:in `each'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/all/runner.rb:110:in `summarize'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/all/runner.rb:56:in `deploy_batch'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/all/runner.rb:35:in `block in deploy_batches'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/all/runner.rb:33:in `each'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/all/runner.rb:33:in `each_with_index'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/all/runner.rb:33:in `deploy_batches'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/all/runner.rb:16:in `block in run'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/all/runner.rb:186:in `time_took'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/all/runner.rb:12:in `run'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/cli/all.rb:43:in `plan'
    from /home/terraspace/.ruby/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
    from /home/terraspace/.ruby/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
    from /home/terraspace/.ruby/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/command.rb:61:in `dispatch'
    from /home/terraspace/.ruby/gems/thor-1.2.1/lib/thor/invocation.rb:116:in `invoke'
    from /home/terraspace/.ruby/gems/thor-1.2.1/lib/thor.rb:243:in `block in subcommand'
    from /home/terraspace/.ruby/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
    from /home/terraspace/.ruby/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
    from /home/terraspace/.ruby/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/command.rb:61:in `dispatch'
    from /home/terraspace/.ruby/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/lib/terraspace/cli/concern.rb:65:in `start'
    from /home/terraspace/.ruby/gems/terraspace-1.1.7/exe/terraspace:14:in `<top (required)>'
    from /home/terraspace/.ruby/bin/terraspace:23:in `load'
    from /home/terraspace/.ruby/bin/terraspace:23:in `<main>'

Step-by-step reproduction instructions

  1. Have a terraspace project with 2 or more stacks. 1 stack must include deprecated terraform (For example s3-bucket module v2.14.1 which is using old AWS provider, )
  2. Use terraspace all plan and you can see the plan fail with the deprecation warning.

If you plan and deploy each stack separately, you don't have an issue.

Code Sample

No code same, but easy to reproduce with the information above.

Solution Suggestion

Not very good at regex myself by maybe the regex could be adjusted to handle this problem?

exoaturner commented 2 years ago

Possibly related to https://github.com/boltops-tools/terraspace/issues/205

exoaturner commented 2 years ago

Seems to be resolved when setting the below:

We were using ubuntu 20.04 docker container:

ENV LANG="C.UTF-8"
ENV LC_ALL="en_US.UTF-8"

RUN apt install -y locales sed \
    && sed -i 's/# \(en_US\.UTF-8 .*\)/\1/g' /etc/locale.gen \
    && locale-gen
exoaturner commented 2 years ago

Maybe a better error message requesting the use to check these environment values are correct?

Not sure if bug should be re-opened?