class TerraformLandscape::TerraformPlan

def display_modified_attribute( # rubocop:disable Metrics/AbcSize, Metrics/MethodLength

rubocop:disable Metrics/AbcSize, Metrics/MethodLength
def display_modified_attribute( # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
  change_color,
  attribute_name,
  attribute_value,
  attribute_value_indent,
  attribute_value_indent_amount
)
  # Since the attribute line is always of the form
  # "old value" => "new value", we can add curly braces and parse with
  # `eval` to obtain a hash with a single key/value.
  old, new = eval("{#{attribute_value}}").to_a.first # rubocop:disable Lint/Eval
  return if old == new # Don't show unchanged attributes
  @out.print "    #{attribute_name}:".ljust(attribute_value_indent_amount, ' ')
    .colorize(change_color)
  if json?(new)
    # Value looks like JSON, so prettify it to make it more readable
    fancy_old = "#{to_pretty_json(old)}\n"
    fancy_new = "#{to_pretty_json(new)}\n"
    display_diff(fancy_old, fancy_new, attribute_value_indent)
  elsif old.include?("\n") || new.include?("\n")
    # Multiline content, so display nicer diff
    display_diff("#{old}\n", "#{new}\n", attribute_value_indent)
  else
    # Typical values, so just show before/after
    @out.print '"' + old.colorize(:red) + '"'
    @out.print ' => '.colorize(:light_black)
    @out.print '"' + new.colorize(:green) + '"'
  end
  @out.newline
end