-
Notifications
You must be signed in to change notification settings - Fork 34
Description
In ruby_terraform 1.8.0 and above, attempts to override the logger output to stdout or stderr both fail. The error does not appear at assignment time (config.stdout = whatever), but at Terraform execution time (e.g. RubyTerraform.init). The error output, using the example from the README, is
/home/app/web/.bundle/ruby/3.2.0/gems/childprocess-5.0.0/lib/childprocess/unix/io.rb:8:in `check_type': expected
#<RubyTerraform::MultiIO:0x0000ffffb0e33298 @targets=[#<Logger::LogDevice:0x0000ffffb26ee6c0 @shift_period_suffix="%Y%m%d",
@shift_size=1048576, @shift_age=7, @filename="/tmp/terraform.log", @dev=#<File:/tmp/terraform.log>, @binmode=false,
@reraise_write_errors=[], @skip_header=false, @mon_data=#<Monitor:0x0000ffffb0e33ae0>, @mon_data_owner_object_id=7480>,
#<Logger::LogDevice:0x0000ffffb10e64b8 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDOUT>>,
@binmode=false, @reraise_write_errors=[], @skip_header=false, @mon_data=#<Monitor:0x0000ffffb0e33400>,
@mon_data_owner_object_id=7500>]> to respond to :to_io (ArgumentError)
I tried several variations of Logger replacements to circumvent this but none of them implement to_io, so they're all doomed. Previously, with ruby_terraform 1.7.0, I used MultiIO to merge the Terraform outputs into a single file without any issues.
I notice that actual usage of an overridden stdout/stderr is not covered by the rspec tests. Those only cover overriding the outputs, not actually using them in a Terraform run (or simulated run).
The error stems from a change in the childprocess gem, required by the update to lino 4.1.0. I'm not sure how difficult/undesirable it would be to revert lino, or whether this is something that can be easily fixed or worked around in some other way, but for now this bug is preventing me from upgrading ruby_terraform, and from offering a PR to add the plan command's support for the generate-config-out option.