26
26
echo "::error:: output my_string not set correctly"
27
27
exit 1
28
28
fi
29
+
30
+ if [[ $(jq -r .output_changes.my_string.actions[0] "${{ steps.output.outputs.json_plan_path }}") != "create" ]]; then
31
+ echo "::error:: json_plan_path not set correctly"
32
+ exit 1
33
+ fi
34
+
35
+ if ! grep -q "No changes" '${{ steps.output.outputs.text_plan_path }}'; then
36
+ echo "::error:: text_plan_path not set correctly"
37
+ exit 1
38
+ fi
29
39
30
40
apply_error :
31
41
runs-on : ubuntu-latest
53
63
echo "::error:: failure-reason not set correctly"
54
64
exit 1
55
65
fi
66
+
67
+ if [[ -n "${{ steps.apply.outputs.json_plan_path }}" ]]; then
68
+ echo "::error:: json_plan_path should not be set"
69
+ exit 1
70
+ fi
71
+
72
+ if [[ -n "${{ steps.apply.outputs.text_plan_path }}" ]]; then
73
+ echo "::error:: text_plan_path should not be set"
74
+ exit 1
75
+ fi
76
+
56
77
57
78
apply_apply_error :
58
79
runs-on : ubuntu-latest
@@ -90,6 +111,16 @@ jobs:
90
111
echo "::error:: failure-reason not set correctly"
91
112
exit 1
92
113
fi
114
+
115
+ if [[ $(jq -r .format_version "${{ steps.apply.outputs.json_plan_path }}") != "0.2" ]]; then
116
+ echo "::error:: json_plan_path not set correctly"
117
+ exit 1
118
+ fi
119
+
120
+ if ! grep -q "Terraform will perform the following actions" '${{ steps.apply.outputs.text_plan_path }}'; then
121
+ echo "::error:: text_plan_path not set correctly"
122
+ exit 1
123
+ fi
93
124
94
125
apply_no_token :
95
126
runs-on : ubuntu-latest
@@ -143,6 +174,39 @@ jobs:
143
174
echo "::error:: output s not set correctly"
144
175
exit 1
145
176
fi
177
+
178
+ if [[ $(jq -r .output_changes.output_string.actions[0] "${{ steps.output.outputs.json_plan_path }}") != "create" ]]; then
179
+ echo "::error:: json_plan_path not set correctly"
180
+ exit 1
181
+ fi
182
+
183
+ if ! grep -q "Terraform will perform the following actions" '${{ steps.output.outputs.text_plan_path }}'; then
184
+ echo "::error:: text_plan_path not set correctly"
185
+ exit 1
186
+ fi
187
+
188
+ - name : Apply
189
+ uses : ./terraform-apply
190
+ id : output
191
+ with :
192
+ path : tests/apply/changes
193
+
194
+ - name : Verify outputs
195
+ run : |
196
+ if [[ "${{ steps.output.outputs.output_string }}" != "the_string" ]]; then
197
+ echo "::error:: output s not set correctly"
198
+ exit 1
199
+ fi
200
+
201
+ if [[ $(jq -r .format_version "${{ steps.output.outputs.json_plan_path }}") != "0.2" ]]; then
202
+ echo "::error:: json_plan_path not set correctly"
203
+ exit 1
204
+ fi
205
+
206
+ if ! grep -q "No changes" '${{ steps.output.outputs.text_plan_path }}'; then
207
+ echo "::error:: text_plan_path not set correctly"
208
+ exit 1
209
+ fi
146
210
147
211
apply_variables :
148
212
runs-on : ubuntu-latest
@@ -215,6 +279,16 @@ jobs:
215
279
echo "::error:: output complex_output not set correctly"
216
280
exit 1
217
281
fi
282
+
283
+ if [[ $(jq -r .output_changes.output_string.actions[0] "${{ steps.output.outputs.json_plan_path }}") != "create" ]]; then
284
+ echo "::error:: json_plan_path not set correctly"
285
+ exit 1
286
+ fi
287
+
288
+ if ! grep -q "Terraform will perform the following actions" '${{ steps.output.outputs.text_plan_path }}'; then
289
+ echo "::error:: text_plan_path not set correctly"
290
+ exit 1
291
+ fi
218
292
219
293
backend_config_12 :
220
294
runs-on : ubuntu-latest
@@ -246,6 +320,16 @@ jobs:
246
320
echo "::error:: output from backend_config file not set correctly"
247
321
exit 1
248
322
fi
323
+
324
+ if [[ $(jq -r .output_changes.test.actions[0] "${{ steps.backend_config_file_12.outputs.json_plan_path }}") != "create" ]]; then
325
+ echo "::error:: json_plan_path not set correctly"
326
+ exit 1
327
+ fi
328
+
329
+ if ! grep -q "No changes" '${{ steps.backend_config_file_12.outputs.text_plan_path }}'; then
330
+ echo "::error:: text_plan_path not set correctly"
331
+ exit 1
332
+ fi
249
333
250
334
- name : Plan
251
335
uses : ./terraform-plan
@@ -272,6 +356,16 @@ jobs:
272
356
echo "::error:: Output from backend_config not set correctly"
273
357
exit 1
274
358
fi
359
+
360
+ if [[ $(jq -r .output_changes.test.actions[0] "${{ steps.backend_config_12.outputs.json_plan_path }}") != "create" ]]; then
361
+ echo "::error:: json_plan_path not set correctly"
362
+ exit 1
363
+ fi
364
+
365
+ if ! grep -q "No changes" '${{ steps.backend_config_file_12.outputs.text_plan_path }}'; then
366
+ echo "::error:: text_plan_path not set correctly"
367
+ exit 1
368
+ fi
275
369
276
370
backend_config_13 :
277
371
runs-on : ubuntu-latest
@@ -303,6 +397,16 @@ jobs:
303
397
echo "::error:: output from backend_config file not set correctly"
304
398
exit 1
305
399
fi
400
+
401
+ if [[ $(jq -r .output_changes.test.actions[0] "${{ steps.backend_config_file_13.outputs.json_plan_path }}") != "create" ]]; then
402
+ echo "::error:: json_plan_path not set correctly"
403
+ exit 1
404
+ fi
405
+
406
+ if ! grep -q "No changes" '${{ steps.backend_config_file_13.outputs.text_plan_path }}'; then
407
+ echo "::error:: text_plan_path not set correctly"
408
+ exit 1
409
+ fi
306
410
307
411
- name : Plan
308
412
uses : ./terraform-plan
@@ -329,6 +433,16 @@ jobs:
329
433
echo "::error:: Output from backend_config not set correctly"
330
434
exit 1
331
435
fi
436
+
437
+ if [[ $(jq -r .output_changes.test.actions[0] "${{ steps.backend_config_13.outputs.json_plan_path }}") != "create" ]]; then
438
+ echo "::error:: json_plan_path not set correctly"
439
+ exit 1
440
+ fi
441
+
442
+ if ! grep -q "No changes" '${{ steps.backend_config_13.outputs.text_plan_path }}'; then
443
+ echo "::error:: text_plan_path not set correctly"
444
+ exit 1
445
+ fi
332
446
333
447
apply_label :
334
448
runs-on : ubuntu-latest
@@ -362,31 +476,17 @@ jobs:
362
476
echo "::error:: output s not set correctly"
363
477
exit 1
364
478
fi
365
-
366
- apply_changes_already_applied :
367
- runs-on : ubuntu-latest
368
- name : Apply when changes are already applied
369
- env :
370
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
371
- needs :
372
- - apply
373
- steps :
374
- - name : Checkout
375
- uses : actions/checkout@v2
376
-
377
- - name : Apply
378
- uses : ./terraform-apply
379
- id : output
380
- with :
381
- path : tests/apply/changes
382
-
383
- - name : Verify outputs
384
- run : |
385
- if [[ "${{ steps.output.outputs.output_string }}" != "the_string" ]]; then
386
- echo "::error:: output s not set correctly"
479
+
480
+ if [[ $(jq -r .output_changes.output_string.actions[0] "${{ steps.output.outputs.json_plan_path }}") != "create" ]]; then
481
+ echo "::error:: json_plan_path not set correctly"
387
482
exit 1
388
483
fi
389
484
485
+ if ! grep -q "Terraform will perform the following actions" '${{ steps.output.outputs.text_plan_path }}'; then
486
+ echo "::error:: text_plan_path not set correctly"
487
+ exit 1
488
+ fi
489
+
390
490
apply_no_changes :
391
491
runs-on : ubuntu-latest
392
492
name : Apply when there are no planned changes
@@ -410,6 +510,16 @@ jobs:
410
510
echo "::error:: output my_string not set correctly"
411
511
exit 1
412
512
fi
513
+
514
+ if [[ $(jq -r .format_version "${{ steps.output.outputs.json_plan_path }}") != "0.2" ]]; then
515
+ echo "::error:: json_plan_path not set correctly"
516
+ exit 1
517
+ fi
518
+
519
+ if ! grep -q "No changes" '${{ steps.output.outputs.text_plan_path }}'; then
520
+ echo "::error:: text_plan_path not set correctly"
521
+ exit 1
522
+ fi
413
523
414
524
apply_no_plan :
415
525
runs-on : ubuntu-latest
@@ -433,6 +543,16 @@ jobs:
433
543
echo "Apply did not fail correctly"
434
544
exit 1
435
545
fi
546
+
547
+ if [[ $(jq -r .format_version "${{ steps.apply.outputs.json_plan_path }}") != "0.2" ]]; then
548
+ echo "::error:: json_plan_path not set correctly"
549
+ exit 1
550
+ fi
551
+
552
+ if ! grep -q "Terraform will perform the following actions" '${{ steps.apply.outputs.text_plan_path }}'; then
553
+ echo "::error:: text_plan_path not set correctly"
554
+ exit 1
555
+ fi
436
556
437
557
apply_user_token :
438
558
runs-on : ubuntu-latest
@@ -463,6 +583,16 @@ jobs:
463
583
exit 1
464
584
fi
465
585
586
+ if [[ $(jq -r .output_changes.output_string.actions[0] "${{ steps.output.outputs.json_plan_path }}") != "create" ]]; then
587
+ echo "::error:: json_plan_path not set correctly"
588
+ exit 1
589
+ fi
590
+
591
+ if ! grep -q "Terraform will perform the following actions" '${{ steps.output.outputs.text_plan_path }}'; then
592
+ echo "::error:: text_plan_path not set correctly"
593
+ exit 1
594
+ fi
595
+
466
596
apply_vars :
467
597
runs-on : ubuntu-latest
468
598
name : Apply approved changes with deprecated vars
0 commit comments