tgwrap 0.11.4__py3-none-any.whl → 0.11.5__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 +33 -2
- tgwrap/main.py +26 -3
- {tgwrap-0.11.4.dist-info → tgwrap-0.11.5.dist-info}/METADATA +11 -3
- {tgwrap-0.11.4.dist-info → tgwrap-0.11.5.dist-info}/RECORD +7 -7
- {tgwrap-0.11.4.dist-info → tgwrap-0.11.5.dist-info}/LICENSE +0 -0
- {tgwrap-0.11.4.dist-info → tgwrap-0.11.5.dist-info}/WHEEL +0 -0
- {tgwrap-0.11.4.dist-info → tgwrap-0.11.5.dist-info}/entry_points.txt +0 -0
tgwrap/cli.py
CHANGED
@@ -240,11 +240,37 @@ def run(command, verbose, debug, dry_run, no_lock, update, upgrade,
|
|
240
240
|
help=r'A glob of a directory that needs to be excluded, this option can be used multiple times. For example: -E "integrations/\*/\*"',
|
241
241
|
show_default=True,
|
242
242
|
)
|
243
|
+
@click.option('--analyze-after-plan', is_flag=True, default=True,
|
244
|
+
help='Analyze the results after a plan',
|
245
|
+
show_default=True
|
246
|
+
)
|
247
|
+
@click.option('--analyze-config', '-A', default=None,
|
248
|
+
help='Name of the analyze config file (or set TGWRAP_ANALYZE_CONFIG environment variable)',
|
249
|
+
envvar='TGWRAP_ANALYZE_CONFIG', type=click.Path(),
|
250
|
+
)
|
251
|
+
@click.option('--ignore-attributes', '-i',
|
252
|
+
multiple=True, default=[],
|
253
|
+
help=r'A glob of attributes for which, during plan, updates can be ignored, this option can be used multiple times (or set TGWRAP_ANALYZE_IGNORE environment variable)',
|
254
|
+
envvar='TGWRAP_ANALYZE_IGNORE',
|
255
|
+
show_default=True
|
256
|
+
)
|
257
|
+
@click.option('--planfile-dir', '-P', default='.terragrunt-cache/current',
|
258
|
+
help='Relative path to directory with plan file (or set TGWRAP_PLANFILE_DIR environment variable), see README for more details',
|
259
|
+
envvar='TGWRAP_PLANFILE_DIR', type=click.Path(),
|
260
|
+
show_default=True,
|
261
|
+
)
|
262
|
+
@click.option('--data-collection-endpoint', '-D', default=None,
|
263
|
+
help='Optional URI of an (Azure) data collection endpoint, to which the analyse results will be sent',
|
264
|
+
envvar='TGWRAP_ANALYZE_DATA_COLLECTION_ENDPOINT',
|
265
|
+
show_default=True,
|
266
|
+
)
|
243
267
|
@click.argument('terragrunt-args', nargs=-1, type=click.UNPROCESSED)
|
244
268
|
@click.version_option(version=__version__)
|
245
269
|
def run_all(command, verbose, debug, dry_run, no_lock, update, upgrade, exclude_external_dependencies,
|
246
|
-
step_by_step, continue_on_error, planfile, auto_approve, clean, working_dir,
|
247
|
-
limit_parallelism, include_dir, exclude_dir,
|
270
|
+
step_by_step, continue_on_error, planfile, auto_approve, clean, working_dir,
|
271
|
+
start_at_step, limit_parallelism, include_dir, exclude_dir,
|
272
|
+
analyze_after_plan, analyze_config, ignore_attributes, planfile_dir, data_collection_endpoint,
|
273
|
+
terragrunt_args):
|
248
274
|
""" Executes a terragrunt command across multiple projects """
|
249
275
|
|
250
276
|
check_latest_version(verbose)
|
@@ -268,6 +294,11 @@ def run_all(command, verbose, debug, dry_run, no_lock, update, upgrade, exclude_
|
|
268
294
|
limit_parallelism=limit_parallelism,
|
269
295
|
include_dirs=include_dir,
|
270
296
|
exclude_dirs=exclude_dir,
|
297
|
+
analyze_after_plan=analyze_after_plan,
|
298
|
+
analyze_config=analyze_config,
|
299
|
+
ignore_attributes=ignore_attributes,
|
300
|
+
planfile_dir=planfile_dir,
|
301
|
+
data_collection_endpoint=data_collection_endpoint,
|
271
302
|
terragrunt_args=terragrunt_args,
|
272
303
|
)
|
273
304
|
|
tgwrap/main.py
CHANGED
@@ -1124,8 +1124,10 @@ class TgWrap():
|
|
1124
1124
|
sys.exit(rc.returncode)
|
1125
1125
|
|
1126
1126
|
def run_all(self, command, debug, dry_run, no_lock, update, upgrade,
|
1127
|
-
exclude_external_dependencies, step_by_step, continue_on_error, planfile, auto_approve,
|
1128
|
-
working_dir, start_at_step, limit_parallelism, include_dirs, exclude_dirs,
|
1127
|
+
exclude_external_dependencies, step_by_step, continue_on_error, planfile, auto_approve,
|
1128
|
+
clean, working_dir, start_at_step, limit_parallelism, include_dirs, exclude_dirs,
|
1129
|
+
analyze_after_plan, analyze_config, ignore_attributes, planfile_dir, data_collection_endpoint,
|
1130
|
+
terragrunt_args):
|
1129
1131
|
""" Executes a terragrunt command across multiple modules """
|
1130
1132
|
|
1131
1133
|
self.printer.verbose(f"Attempting to execute 'run-all {command}'")
|
@@ -1157,6 +1159,7 @@ class TgWrap():
|
|
1157
1159
|
if clean and not dry_run:
|
1158
1160
|
self.clean(working_dir=working_dir)
|
1159
1161
|
|
1162
|
+
rc = None
|
1160
1163
|
if step_by_step:
|
1161
1164
|
self.printer.verbose(
|
1162
1165
|
f'This command will be executed for each individual module:\n$ {cmd}'
|
@@ -1183,9 +1186,29 @@ class TgWrap():
|
|
1183
1186
|
self.printer.warning('In dry run mode, no real actions are executed!!')
|
1184
1187
|
else:
|
1185
1188
|
rc = subprocess.run(shlex.split(cmd))
|
1189
|
+
|
1186
1190
|
self.printer.verbose(rc)
|
1187
1191
|
|
1188
|
-
|
1192
|
+
# if we are planning, and analyze is requested, we need to run the analysis
|
1193
|
+
if analyze_after_plan and command.lower() == 'plan':
|
1194
|
+
self.printer.verbose('Analyze after plan requested')
|
1195
|
+
self.analyze(
|
1196
|
+
exclude_external_dependencies=exclude_external_dependencies,
|
1197
|
+
working_dir=working_dir,
|
1198
|
+
start_at_step=0,
|
1199
|
+
out=None,
|
1200
|
+
parallel_execution=None,
|
1201
|
+
analyze_config=analyze_config,
|
1202
|
+
ignore_attributes=ignore_attributes,
|
1203
|
+
include_dirs=include_dirs,
|
1204
|
+
exclude_dirs=exclude_dirs,
|
1205
|
+
planfile_dir=planfile_dir,
|
1206
|
+
data_collection_endpoint=data_collection_endpoint,
|
1207
|
+
terragrunt_args=terragrunt_args,
|
1208
|
+
)
|
1209
|
+
|
1210
|
+
if rc:
|
1211
|
+
sys.exit(rc.returncode)
|
1189
1212
|
|
1190
1213
|
def run_import(self, address, id, dry_run, working_dir, no_lock, terragrunt_args):
|
1191
1214
|
""" Executes the terragrunt/terraform import command """
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: tgwrap
|
3
|
-
Version: 0.11.
|
3
|
+
Version: 0.11.5
|
4
4
|
Summary: A (terragrunt) wrapper around a (terraform) wrapper around ....
|
5
5
|
License: MIT
|
6
6
|
Keywords: terraform,terragrunt,terrasafe,python
|
@@ -145,7 +145,7 @@ export TGWRAP_PLANFILE_DIR=".terragrunt-cache/current"
|
|
145
145
|
|
146
146
|
Or pass it along with the `--planfile-dir|-P` option and it will use that.
|
147
147
|
|
148
|
-
|
148
|
+
## 5. Logging the results
|
149
149
|
|
150
150
|
`tgwrap` supports logging the analyze results to an [Azure Log Analytics](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/log-analytics-overview) custom table.
|
151
151
|
|
@@ -214,7 +214,15 @@ The log analytics (custom) table should have a schema that is able to cope with
|
|
214
214
|
| unknown | Int |
|
215
215
|
| updates | Int |
|
216
216
|
|
217
|
-
|
217
|
+
# Terraform vs OpenTofu
|
218
|
+
|
219
|
+
`tgwrap` is compatible with both [terraform](https://www.terraform.io/) and [opentofu](https://opentofu.org/).
|
220
|
+
|
221
|
+
As we are **almost** exclusively relying on `terragrunt` to invoke them on our behalf, there is not much exposure to that decision.
|
222
|
+
|
223
|
+
However, there is one exception (and maybe there will be more in the future) where this is not true. For that we rely on the existance of the `tf` binary (or symbolic link, or alias and so on). It is managed automatically by the [tenv tool](https://github.com/tofuutils/tenv) (higly recommended!), but if you don't want to use it, make sure you create an alias or something like that.
|
224
|
+
|
225
|
+
# More than a wrapper
|
218
226
|
|
219
227
|
Over time, tgwrap became more than a wrapper, blantly violating [#1 of the unix philosophy](https://en.wikipedia.org/wiki/Unix_philosophy#:~:text=The%20Unix%20philosophy%20is%20documented,%2C%20as%20yet%20unknown%2C%20program.): 'Make each program do one thing well'.
|
220
228
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
tgwrap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
tgwrap/analyze.py,sha256=fuET7_L8b6rlv2qnKOYXSlIv5LArvZ39CPktCeQHo7A,10285
|
3
|
-
tgwrap/cli.py,sha256=
|
3
|
+
tgwrap/cli.py,sha256=7VPowJ9DtbtbOsl5s01Vj0rsMTQuin5KhvOTbNTSQZA,33551
|
4
4
|
tgwrap/deploy.py,sha256=gwFdRDzJWjkmEzZ8b0GUSrgvJeOKnpnJm1c6mM80OcY,10259
|
5
5
|
tgwrap/inspector-resources-template.yml,sha256=Mos8NDzzZ3VxdXgeiVL9cmQfRcIXIHMLf79_KLwdXu8,3297
|
6
6
|
tgwrap/inspector.py,sha256=5pW7Ex1lkKRoXY6hZGbCNmSD2iRzgMSfqi9w7gb-AcY,16990
|
7
|
-
tgwrap/main.py,sha256=
|
7
|
+
tgwrap/main.py,sha256=mPVVWJC_zXz9ozWwvkBGrWn8t9hytI812pCh5zxRd44,95862
|
8
8
|
tgwrap/printer.py,sha256=frn1PARd8A28mkRCYR6ybN2x0NBULhNOutn4l2U7REY,2754
|
9
|
-
tgwrap-0.11.
|
10
|
-
tgwrap-0.11.
|
11
|
-
tgwrap-0.11.
|
12
|
-
tgwrap-0.11.
|
13
|
-
tgwrap-0.11.
|
9
|
+
tgwrap-0.11.5.dist-info/LICENSE,sha256=VT-AVxIXt3EQTC-7Hy1uPGnrDNJLqfcgLgJD78fiyx4,1065
|
10
|
+
tgwrap-0.11.5.dist-info/METADATA,sha256=QvyHQUE4WALyXsMIxnN-qRubvp33iv4JxhzS3knJkdw,18355
|
11
|
+
tgwrap-0.11.5.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
12
|
+
tgwrap-0.11.5.dist-info/entry_points.txt,sha256=H8X0PMPmd4aW7Y9iyChZ0Ug6RWGXqhRUvHH-6f6Mxz0,42
|
13
|
+
tgwrap-0.11.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|