tgwrap 0.8.12__py3-none-any.whl → 0.8.14__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
tgwrap/cli.py CHANGED
@@ -50,7 +50,7 @@ CLICK_CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
50
50
 
51
51
  TG_COMMANDS=[
52
52
  'init', 'validate', 'validate-inputs', 'plan', 'apply',
53
- 'destroy', 'info', 'output', 'show',
53
+ 'destroy', 'info', 'output', 'show', 'state',
54
54
  ]
55
55
  STAGES=['global', 'sbx', 'dev', 'qas', 'run', 'tst', 'acc', 'prd']
56
56
  class DefaultGroup(click.Group):
@@ -107,7 +107,7 @@ def main():
107
107
  ignore_unknown_options=True,
108
108
  ),
109
109
  )
110
- @click.argument('command', type=click.Choice(TG_COMMANDS + ['state', 'render-json']))
110
+ @click.argument('command', type=click.Choice(TG_COMMANDS + ['render-json']))
111
111
  @click.option('--verbose', '-v', is_flag=True, default=False,
112
112
  help='Verbose printing',
113
113
  show_default=True
@@ -210,6 +210,10 @@ def run(command, verbose, debug, dry_run, no_lock, update, upgrade,
210
210
  help='Run the command step by step and stop when an error occurs (where applicable)',
211
211
  show_default=True
212
212
  )
213
+ @click.option('--continue-on-error', '-C', is_flag=True, default=False,
214
+ help='When running in step by step, continue when an error occurs',
215
+ show_default=True
216
+ )
213
217
  @click.option('--planfile', '-p', is_flag=True, default=False,
214
218
  help='Use the generated planfile when applying the changes',
215
219
  show_default=True
@@ -244,7 +248,7 @@ def run(command, verbose, debug, dry_run, no_lock, update, upgrade,
244
248
  @click.argument('terragrunt-args', nargs=-1, type=click.UNPROCESSED)
245
249
  @click.version_option(version=__version__)
246
250
  def run_all(command, verbose, debug, dry_run, no_lock, update, upgrade, exclude_external_dependencies,
247
- step_by_step, planfile, auto_approve, clean, working_dir, start_at_step,
251
+ step_by_step, continue_on_error, planfile, auto_approve, clean, working_dir, start_at_step,
248
252
  limit_parallelism, include_dir, exclude_dir, terragrunt_args):
249
253
  """ Executes a terragrunt command across multiple projects """
250
254
 
@@ -260,6 +264,7 @@ def run_all(command, verbose, debug, dry_run, no_lock, update, upgrade, exclude_
260
264
  upgrade=upgrade,
261
265
  exclude_external_dependencies=exclude_external_dependencies,
262
266
  step_by_step=step_by_step,
267
+ continue_on_error=continue_on_error,
263
268
  planfile=planfile,
264
269
  auto_approve=auto_approve,
265
270
  clean=clean,
@@ -287,9 +292,10 @@ def run_all(command, verbose, debug, dry_run, no_lock, update, upgrade, exclude_
287
292
  @click.option('--json', '-j', is_flag=True, default=False,
288
293
  help='Show output in json format',
289
294
  )
290
- @click.option('--planfile-dir', '-P', default=None,
295
+ @click.option('--planfile-dir', '-P', default='.terragrunt-cache/current',
291
296
  help='Relative path to directory with plan file (or set TGWRAP_PLANFILE_DIR environment variable), see README for more details',
292
297
  envvar='TGWRAP_PLANFILE_DIR', type=click.Path(),
298
+ show_default=True,
293
299
  )
294
300
  @click.argument('terragrunt-args', nargs=-1, type=click.UNPROCESSED)
295
301
  @click.version_option(version=__version__)
@@ -392,9 +398,10 @@ def run_import(address, id, verbose, dry_run, working_dir, no_lock, terragrunt_a
392
398
  help='A glob of a directory that needs to be excluded, this option can be used multiple times. For example: -E "integrations/\*/\*"',
393
399
  show_default=True,
394
400
  )
395
- @click.option('--planfile-dir', '-P', default=None,
401
+ @click.option('--planfile-dir', '-P', default='.terragrunt-cache/current',
396
402
  help='Relative path to directory with plan file (or set TGWRAP_PLANFILE_DIR environment variable), see README for more details',
397
403
  envvar='TGWRAP_PLANFILE_DIR', type=click.Path(),
404
+ show_default=True,
398
405
  )
399
406
  @click.argument('terragrunt-args', nargs=-1, type=click.UNPROCESSED)
400
407
  @click.version_option(version=__version__)
tgwrap/main.py CHANGED
@@ -102,7 +102,7 @@ class TgWrap():
102
102
  'info': '{base_command} terragrunt-info --terragrunt-non-interactive {update} {upgrade} {common}',
103
103
  'plan': '{base_command} {command} --terragrunt-non-interactive -out={planfile_name} {lock_level} {update} {parallelism} {common}',
104
104
  'apply': '{base_command} {command} {non_interactive} {no_auto_approve} {update} {parallelism} {common} {planfile}',
105
- 'show': '{base_command} {command} --terragrunt-non-interactive {planfile_name} {common}',
105
+ 'show': '{base_command} {command} --terragrunt-non-interactive {common} {planfile_name}',
106
106
  'destroy': '{base_command} {command} {non_interactive} {no_auto_approve} {parallelism} {common} {planfile}',
107
107
  }
108
108
 
@@ -656,7 +656,7 @@ class TgWrap():
656
656
  self, command, exclude_external_dependencies, start_at_step, dry_run,
657
657
  parallel_execution=False, ask_for_confirmation=False, collect_output_file=None,
658
658
  backwards=False, working_dir=None, include_dirs=[], exclude_dirs=[],
659
- use_native_terraform=False, add_to_workdir=None,
659
+ use_native_terraform=False, add_to_workdir=None, continue_on_error=False,
660
660
  ):
661
661
  "Runs the desired command in the directories as defined in the directed graph"
662
662
 
@@ -753,7 +753,7 @@ class TgWrap():
753
753
  progress=progress,
754
754
  )
755
755
 
756
- if stop_processing:
756
+ if stop_processing and not continue_on_error:
757
757
  self.printer.warning(f"Processing needs to be stopped at step {step_nbr}.")
758
758
  self.printer.normal(
759
759
  f"After you've fixed the problem, you can continue where you left off by adding '--start-at-step {step_nbr}'."
@@ -884,14 +884,14 @@ class TgWrap():
884
884
  # tgwrap state mv 'azuread_group.this["viewers"]' 'azuread_group.this["readers"]'
885
885
  rc = subprocess.run(
886
886
  shlex.split(cmd, posix=False),
887
- cwd=cwd,
887
+ cwd=cwd if cwd else None,
888
888
  )
889
889
  self.printer.verbose(rc)
890
890
 
891
891
  sys.exit(rc.returncode)
892
892
 
893
893
  def run_all(self, command, debug, dry_run, no_lock, update, upgrade,
894
- exclude_external_dependencies, step_by_step, planfile, auto_approve, clean,
894
+ exclude_external_dependencies, step_by_step, continue_on_error, planfile, auto_approve, clean,
895
895
  working_dir, start_at_step, limit_parallelism, include_dirs, exclude_dirs, terragrunt_args):
896
896
  """ Executes a terragrunt command across multiple modules """
897
897
 
@@ -903,10 +903,6 @@ class TgWrap():
903
903
  modifying_command = (command.lower() in ['apply', 'destroy'])
904
904
  auto_approve = auto_approve if modifying_command else True
905
905
 
906
- # if the dir is not ending on '/*', add it
907
- include_dirs = [dir.rstrip(f'.{os.path.sep}*') + f'{os.path.sep}*' for dir in include_dirs]
908
- exclude_dirs = [dir.rstrip(f'.{os.path.sep}*') + f'{os.path.sep}*' for dir in exclude_dirs]
909
-
910
906
  cmd = self._construct_command(
911
907
  command=command,
912
908
  allow_no_run_all=False,
@@ -933,11 +929,16 @@ class TgWrap():
933
929
  f'This command will be executed for each individual module:\n$ {cmd}'
934
930
  )
935
931
 
932
+ # if the dir is not ending on '/*', add it
933
+ include_dirs = [dir.rstrip(f'.{os.path.sep}*') + f'{os.path.sep}*' for dir in include_dirs]
934
+ exclude_dirs = [dir.rstrip(f'.{os.path.sep}*') + f'{os.path.sep}*' for dir in exclude_dirs]
935
+
936
936
  self._run_di_graph(
937
937
  command=cmd,
938
938
  exclude_external_dependencies=exclude_external_dependencies,
939
939
  working_dir=working_dir,
940
940
  ask_for_confirmation=(not auto_approve),
941
+ continue_on_error=continue_on_error,
941
942
  dry_run=dry_run,
942
943
  start_at_step=start_at_step,
943
944
  backwards=True if command.lower() in ['destroy'] else False,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tgwrap
3
- Version: 0.8.12
3
+ Version: 0.8.14
4
4
  Summary: A (terragrunt) wrapper around a (terraform) wrapper around ....
5
5
  Home-page: https://gitlab.com/lunadata/tgwrap
6
6
  License: MIT
@@ -0,0 +1,11 @@
1
+ tgwrap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ tgwrap/analyze.py,sha256=CsSaGv-be6ATy36z9X7x00gpKY59soJys2VbIzD-tmg,8726
3
+ tgwrap/cli.py,sha256=ZOt_aEGhfKGC81FhC5PNF8qhEuc5apyQC3ipQOonjco,29388
4
+ tgwrap/deploy.py,sha256=bJiox_fz8JsoPreX4woW6-EqAebhpJWnKUVLVeGXkrI,10000
5
+ tgwrap/main.py,sha256=Dqqzqe2x7UXHgAgQL764CfoZ6V0JFbk4TphBkBcYcC8,74872
6
+ tgwrap/printer.py,sha256=dkcOCPIPB-IP6pn8QMpa06xlcqPFVaDvxnz-QEpDJV0,2663
7
+ tgwrap-0.8.14.dist-info/LICENSE,sha256=VT-AVxIXt3EQTC-7Hy1uPGnrDNJLqfcgLgJD78fiyx4,1065
8
+ tgwrap-0.8.14.dist-info/METADATA,sha256=Z-7SMM8jMi00xbW-PRAiF8ZGuoyER3S_h_YEoYLK4M4,11616
9
+ tgwrap-0.8.14.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
10
+ tgwrap-0.8.14.dist-info/entry_points.txt,sha256=H8X0PMPmd4aW7Y9iyChZ0Ug6RWGXqhRUvHH-6f6Mxz0,42
11
+ tgwrap-0.8.14.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- tgwrap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- tgwrap/analyze.py,sha256=CsSaGv-be6ATy36z9X7x00gpKY59soJys2VbIzD-tmg,8726
3
- tgwrap/cli.py,sha256=weYPXnpZ1200L28tNGzVaO_GlX7wAdLn1nQZsHKpe3k,29060
4
- tgwrap/deploy.py,sha256=bJiox_fz8JsoPreX4woW6-EqAebhpJWnKUVLVeGXkrI,10000
5
- tgwrap/main.py,sha256=82f4Wc-jPczDpP4vCMeJeaF1CBfiDGizNy0KDw_iDZw,74720
6
- tgwrap/printer.py,sha256=dkcOCPIPB-IP6pn8QMpa06xlcqPFVaDvxnz-QEpDJV0,2663
7
- tgwrap-0.8.12.dist-info/LICENSE,sha256=VT-AVxIXt3EQTC-7Hy1uPGnrDNJLqfcgLgJD78fiyx4,1065
8
- tgwrap-0.8.12.dist-info/METADATA,sha256=RGlxakJg0v5wKWoma5H3rip2BTJ7mcmbq41iazo-VVE,11616
9
- tgwrap-0.8.12.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
10
- tgwrap-0.8.12.dist-info/entry_points.txt,sha256=H8X0PMPmd4aW7Y9iyChZ0Ug6RWGXqhRUvHH-6f6Mxz0,42
11
- tgwrap-0.8.12.dist-info/RECORD,,