Skip to content

Commit 11dcd4f

Browse files
authored
Merge pull request #45 from coinbase/fix-dashed-lines
Fix handling of dashed line separators after refresh output
2 parents 076bc72 + 4bd82b3 commit 11dcd4f

4 files changed

Lines changed: 37 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Terraform Landscape Change Log
22

3+
## 0.1.17
4+
5+
* Fix handling of dashed line separators after state refresh output
6+
37
## 0.1.16
48

59
* Fix handling of initialization messages output by `terraform init`

lib/terraform_landscape/printer.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def process_string(plan_output)
4343
# as these break the parser which thinks "-" is a resource deletion
4444
scrubbed_output.gsub!(/^- .*\.\.\.$/, '')
4545

46+
# Remove separation lines that appear after refreshing state
47+
scrubbed_output.gsub!(/^-+$/, '')
48+
4649
# Remove preface
4750
if (match = scrubbed_output.match(/^Path:[^\n]+/))
4851
scrubbed_output = scrubbed_output[match.end(0)..-1]

lib/terraform_landscape/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
# Defines the gem version.
44
module TerraformLandscape
5-
VERSION = '0.1.16'.freeze
5+
VERSION = '0.1.17'.freeze
66
end

spec/printer_spec.rb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,5 +177,34 @@
177177
No changes
178178
OUT
179179
end
180+
181+
context 'when output contains a separator after refreshing state' do
182+
let(:terraform_output) { normalize_indent(<<-TXT) }
183+
Refreshing Terraform state in-memory prior to plan...
184+
The refreshed state will be used to calculate this plan, but will not be
185+
persisted to local or remote state storage.
186+
187+
aws_vpc.poc: Refreshing state... (ID: ##vpc-xxxxxxxxxxxxx)
188+
data.aws_iam_policy_document.flowlogs: Refreshing state...
189+
data.aws_iam_policy_document.rds_assume_policy: Refreshing state...
190+
data.aws_iam_policy_document.flowlogs_assume_role_policy: Refreshing state...
191+
aws_iam_role.rds: Refreshing state... (ID: xxxxxxxxxxxxxxxxxRole)
192+
aws_iam_role.flowlogs: Refreshing state... (ID: xxxxxxxxxxxxxxRole)
193+
aws_iam_role_policy.flowlogs: Refreshing state... (ID: xxxxxxxxxxxxxCreatePolicy)
194+
aws_iam_role_policy_attachment.rds: Refreshing state... (ID: xxxxxxxxxxxxxxRole-20171030050803915500000001)
195+
196+
------------------------------------------------------------------------
197+
198+
No changes. Infrastructure is up-to-date.
199+
200+
This means that Terraform did not detect any differences between your
201+
configuration and real physical resources that exist. As a result, no
202+
actions need to be performed.
203+
TXT
204+
205+
it { should == normalize_indent(<<-OUT) }
206+
No changes
207+
OUT
208+
end
180209
end
181210
end

0 commit comments

Comments
 (0)