Skip to content

Commit

Permalink
Merge 5bf63f2 into 8988c4f
Browse files Browse the repository at this point in the history
  • Loading branch information
0xch4z committed Jan 8, 2019
2 parents 8988c4f + 5bf63f2 commit a28502c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export interface ParseResult {
changedDataSources: Array<Changed>;
}

const NO_CHANGES_STRING = '\nNo changes. Infrastructure is up-to-date.\n';
const CONTENT_START_STRING = '\nTerraform will perform the following actions:\n';
const CONTENT_END_STRING = '\nPlan:';
const OLD_NEW_SEPARATOR = ' => ';
Expand Down Expand Up @@ -356,6 +357,11 @@ export function parseStdout (logOutput: string): ParseResult {

let lastChange = null;

if (logOutput.includes(NO_CHANGES_STRING)) {
// no changes to parse...
return result;
}

const startPos = findParseableContentStartPos(logOutput);
if (startPos === -1) {
result.errors.push({
Expand Down
5 changes: 5 additions & 0 deletions test/unit/data/13-no-changes.expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"errors": [],
"changedResources": [],
"changedDataSources": []
}
12 changes: 12 additions & 0 deletions test/unit/data/13-no-changes.stdout.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.


------------------------------------------------------------------------

No changes. Infrastructure is up-to-date.

This means that Terraform did not detect any differences between your
configuration and real physical resources that exist. As a result, no
actions need to be performed.
4 changes: 4 additions & 0 deletions test/unit/terraform-plan-parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,7 @@ test('should handle tainted resources', async (t) => {
test('should handle modules', async (t) => {
return runTest('12-modules', t);
});

test('should handle no changes', async (t) => {
return runTest('13-no-changes', t);
});

0 comments on commit a28502c

Please sign in to comment.