MCPcopy Create free account
hub / github.com/dflook/terraform-github-actions / compact_plan

Function compact_plan

image/tools/compact_plan.py:6–32  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

4
5
6def compact_plan(input):
7 plan = False
8 buffer = []
9
10 for line in input:
11
12 if not plan and (
13 line.startswith('Terraform used the selected providers') or
14 line.startswith('OpenTofu used the selected providers') or
15 line.startswith('An execution plan has been generated and is shown below') or
16 line.startswith('No changes') or
17 line.startswith('Error') or
18 line.startswith('Changes to Outputs:') or
19 line.startswith('Terraform will perform the following actions:') or
20 line.startswith('OpenTofu will perform the following actions:')
21 ):
22 plan = True
23
24 if plan:
25 if not (line.startswith('Releasing state lock. This may take a few moments...')
26 or line.startswith('Acquiring state lock. This may take a few moments...')):
27 yield line
28 else:
29 buffer.append(line)
30
31 if not plan and buffer:
32 yield from buffer
33
34
35if __name__ == '__main__':

Calls

no outgoing calls