class TerraformLandscape::TerraformPlan
def display_modified_attribute(
def display_modified_attribute( change_color, attribute_name, attribute_value, attribute_change_reason, attribute_value_indent, attribute_value_indent_amount ) # Since the attribute line is always of the form "old value" => "new value" attribute_value =~ /^ *(".*") *=> *(".*") *$/ old = Regexp.last_match[1].undump new = Regexp.last_match[2].undump return if old == new && new != '<sensitive>' # 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 if attribute_change_reason @out.print " (#{attribute_change_reason})".colorize(:magenta) end @out.newline end