Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Adjusting strict control docs #3838

Merged
merged 5 commits into from
Feb 6, 2025

Conversation

yhakbar
Copy link
Collaborator

@yhakbar yhakbar commented Feb 4, 2025

Description

Fixes #000.

TODOs

Read the Gruntwork contribution guidelines.

  • Update the docs.
  • Run the relevant tests successfully, including pre-commit checks.
  • Ensure any 3rd party code adheres with our license policy or delete this line if its not applicable.
  • Include release notes. If this PR is backward incompatible, include a migration guide.

Release Notes (draft)

Added / Removed / Updated [X].

Migration Guide

Comment on lines +214 to +221
- [plan-all](#plan-all)
- [apply-all](#apply-all)
- [destroy-all](#destroy-all)
- [output-all](#output-all)
- [validate-all](#validate-all)
- [spin-up](#spin-up)
- [tear-down](#tear-down)
- [default-command](#default-command)
Copy link
Contributor

@levkohimins levkohimins Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

info strict deprecated-commands

   Default commands:
   console    replaced with: terragrunt run -- console
   env        replaced with: terragrunt run -- env
   fmt        replaced with: terragrunt run -- fmt
   get        replaced with: terragrunt run -- get
   graph      replaced with: terragrunt run -- graph
   login      replaced with: terragrunt run -- login
   logout     replaced with: terragrunt run -- logout
   metadata   replaced with: terragrunt run -- metadata
   providers  replaced with: terragrunt run -- providers
   push       replaced with: terragrunt run -- push
   taint      replaced with: terragrunt run -- taint
   untaint    replaced with: terragrunt run -- untaint
   version    replaced with: terragrunt run -- version
   workspace  replaced with: terragrunt run -- workspace

   `*-all` commands:
   apply-all     replaced with: terragrunt run-all apply
   destroy-all   replaced with: terragrunt run-all destroy
   output-all    replaced with: terragrunt run-all output
   plan-all      replaced with: terragrunt run-all plan
   spin-up       replaced with: terragrunt run-all apply
   tear-down     replaced with: terragrunt run-all destroy
   validate-all  replaced with: terragrunt run-all validate

info strict legacy-all

   `*-all` commands:
   apply-all     replaced with: terragrunt run-all apply
   destroy-all   replaced with: terragrunt run-all destroy
   output-all    replaced with: terragrunt run-all output
   plan-all      replaced with: terragrunt run-all plan
   spin-up       replaced with: terragrunt run-all apply
   tear-down     replaced with: terragrunt run-all destroy
   validate-all  replaced with: terragrunt run-all validate

info strict default-command

   Default commands:
   console    replaced with: terragrunt run -- console
   env        replaced with: terragrunt run -- env
   fmt        replaced with: terragrunt run -- fmt
   get        replaced with: terragrunt run -- get
   graph      replaced with: terragrunt run -- graph
   login      replaced with: terragrunt run -- login
   logout     replaced with: terragrunt run -- logout
   metadata   replaced with: terragrunt run -- metadata
   providers  replaced with: terragrunt run -- providers
   push       replaced with: terragrunt run -- push
   taint      replaced with: terragrunt run -- taint
   untaint    replaced with: terragrunt run -- untaint
   version    replaced with: terragrunt run -- version
   workspace  replaced with: terragrunt run -- workspace

I don't see the point in users to specify the old *-all commands separately, one by one in the -struct-cotnrol, and I don't see the point in indicating this in the documentation, although I will implement it so that it works, for backward compatibility but I don't see the point in overloading users' brains with these commands, instead we need to give an example of using -strict-control default-command, -strict-control legacy-all ... and indicate which commands/flags are included in each group, what info strict legacy-all, info strict default-command info strict cli-restructure ... output, copy/past. Or, in order not to bloat the documentation, suggest that the user run it and see for themselves what they include.

In this docs we give example to use the old run-all separately, but in the same time we show the deprecated "Default commands" as one default-command control, this is not consistent. In such cases, we need to provide the ability to enable strict control for each default command separately as well.

-struct-cotnrol fmt
-struct-cotnrol get
....

then as well for cli restructure commands:

-strict-control terragrunt-info
-strict-control hclfmt
....

and so on, then mention them in this list as well

Suggested change
- [plan-all](#plan-all)
- [apply-all](#apply-all)
- [destroy-all](#destroy-all)
- [output-all](#output-all)
- [validate-all](#validate-all)
- [spin-up](#spin-up)
- [tear-down](#tear-down)
- [default-command](#default-command)
- [plan-all](#plan-all)
- [apply-all](#apply-all)
- [destroy-all](#destroy-all)
- [output-all](#output-all)
- [validate-all](#validate-all)
- [spin-up](#spin-up)
- [tear-down](#tear-down)
- [console](#console)
- [env](#env)
- [fmt](#fmt)
- [get](#get)
- [graph](#graph)
...

But I wouldn't do that. If I were the user, I would only use:
-strict-control default-command
-strict-control legacy-all
-strict-control cli-restructure

or if I wanted to enable strict for all deprecated commands -strict-control deprecated-commands, but never -strict-control plan-all,-strict-control terragrunt-info ...

15:26:08.585 WARN The `plan-all` command is deprecated and will be removed in a future version. Use `terragrunt run-all plan` instead.
```

```bash
$ terragrunt plan-all --strict-control deprecated-commands
$ terragrunt plan-all --strict-control plan-all
Copy link
Contributor

@levkohimins levkohimins Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point of the user uses this

terragrunt plan-all --strict-control plan-all

to enable strict control for the plan-all command, and then to intentionally specify the plan-all command itself. At the same time, knowing that he will 100% get an error.
In my understanding, strict control should help the user from unintentionally using deprecated commands and flags.

That's why it makes more sense to use this command

terragrunt plan-all --strict-control legacy-all

Copy link

vercel bot commented Feb 5, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
terragrunt-docs ❌ Failed (Inspect) Feb 5, 2025 5:56pm

@yhakbar yhakbar merged commit 6396cb7 into feat/run-command Feb 6, 2025
5 of 8 checks passed
@yhakbar yhakbar deleted the fix/adjusting-strict-docs branch February 6, 2025 00:27
levkohimins added a commit that referenced this pull request Feb 10, 2025
…aming. (#3723)

* fix: exec command implementation

* fix: flags duplication

* chore: update golangci-lint

* fix: log level

* fix: revert pointer

* fix: no-color flag duplication

* fix: golint

* fix: strict mode test

* chore: deprecated name funcs improvement

* fix: deprecated names prefix

* chore: handle formatter error

* chore: debugging provider cache

* chore: remove debug code

* chore: debug code

* fix: update test envs

* chore: exec-cmd integration test

* chore: docs update

* fix: app_test

* fix: markdown

* fix: markdown

* fix: tests

* fix: render-json flag names

* chore: get rid of unnecessary flags for some commands

* chore: docs update

* chore: make `-non-interactive` flag global.

* fix: test

* chore: docs update

* chore: docs update

* chore: rename `terraform` package to `run`

* chore: sorting flags

* chore: cli flag parsing improvements

* fix: cli arg parsing

* chore: cli flag parsing improvements

* chore: move cli package to internal

* fix: test

* fix: strict go lint

* chore: resolve conflict

* chore: commands restructuring

* chore: move version_check

* chore: split shell package

* fix: unit tests

* fix: unit tests

* chore: clone options

* chore: opts cloning improvements

* chore: wrap error

* fix: resolve config path for run command

* fix: cloning opts

* chore: golint strict

* chore: code improvements

* chore: move default command

* fix: log tf output command

* fix: unit test

* chore: move `version_check` back to `run` package

* fix: circleci config

* chore: add help and test for `run` command

* chore: code improvements

* chore: help for the default command

* feat: Rename `cli-options` page to `cli`

* feat: Reorganizing CLI page

* fix: Removing unnecessary docs files

* feat: Adding migration guide

* fix: Reorganizing commands

* chore: fix tests, exec command improvement

* fix: Addressing markdownlint errors

* chore: change `options` cloning

* fix: tests

* fix: tests

* fix: windows error: too big path

* fix: temp dir path

* fix: creating tmp dir

* chore: add comment

* fix: TestExecCommand test

* chore: code improvements

* fix: pr issues

* fix: test

* chore: cli-design experiment, cli help improvements

* fix: markdown

* fix: Fixing race condition in `TestDownloadTerraformSourceFromLocalFolderWithManifest` test

* fix: tests

* fix: test

* fix: test

* fix: test

* fix: Adding `graph` to list of commands that force forward

* chore: help unit test

* chore: flag setter func

* fix: test

* chore: remove debug code

* fix: unit tests

* fix: unit tests

* chore: code improvement

* chore: strict package refactoring

* chore: fix tests

* chore: experiment package refactoring

* chore: docs update

* chore: code improvements

* fix: tests

* chore: move back to control `dependencies-inputs`

* chore: revert `skip-dependencies-inputs`

* chore: fix pr comments

* chore: get rid of LogFormatter from Options

* fix: tests

* fix: tests

* fix: test

* chore: fix issues, strict control improvements

* fix: terragrunt config path resolving

* chore: Renaming the CLI options file to align with `main`

* chore: Merging in `main` adjustments

* fix: Resolving conflicts with main

* fix: Fixing inaccuracy in flag docs

* fix: Resolving the rest of the conflicts

* fix: Fixing shortcuts docs

* fix: Fixing line on flexibility

* fix: Fixing example for run with dashes

* fix: More fixes for call-outs to experiments

* fix: More docs cleanup

* fix: resolving merging conflicts `cli.md`

* docs: Adding experiment docs

* chore: rename cli-redesign.md

* chore: removing fixing too longpath by changing TMP dir

* fix: markdown lint

* fix: stack args

* chore: code improvements

* fix: fix global deprecated flags.

* fix: unit test

* chore: code comments

* chore: docs update

* fix: enable strict control

* fix: unit test

* chore: redone shortcuts commands

* fix: Adjusting strict control docs (#3838)

* fix: Adjusting strict control docs

* fix: Missed some strict controls

* fix: Adjusting strict docs so that the categories are shown earlier

* fix: Fixing this again

* fix: Fixing again

* fix: Renaming `strict.go` filename

* fix: Fixing `depreacedName` name typo

* fix: Adding WIP to migration docs for CLI Redesign

* fix: Fixing docs for `terragrunt-info`

* fix: Fixing wording of `graph` docs

* fix: Fixing docs for dependency blocks

* fix: Fixing typo in `run-all` docs

* fix: Cleand up formatting docs

* fix: Fixing `diff` docs

* fix: Fixing includes docs

* fix: Breaking up control usage over multiple lines so that it's easier to read

* fix: Fixing typo in `help_test.go`

* fix: Fixing `flag_opts.go` example typo

* fix: Fixing docs bugs

* fix: Checking error in `help_test.go`

* fix: Typo in `exec` help

* fix: Don't prioritize Terraform

* chore: strict control for moved global flags

* fix: strict control msgs

* fix: run cmd usage.

* fix: cli slice/map flags

* fix: test

* fix: grammar

* fix: Removing accidentally committed file.

* chore: coderabbitai's suggestions

* fix: stack flags

* fix: go-lint

* fix: tests

* fix: markdown lint

---------

Co-authored-by: Yousif Akbar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants