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

feat: Improve error handling and messaging #11

Open
mbevc1 opened this issue Jun 11, 2024 · 2 comments
Open

feat: Improve error handling and messaging #11

mbevc1 opened this issue Jun 11, 2024 · 2 comments

Comments

@mbevc1
Copy link

mbevc1 commented Jun 11, 2024

Couple of suggestions as it came across as a bit unintuitive when trying:

  • init on empty module list probably shouldn't be an error and cold be a warning, so you could have module without submodules, thus just nothing to do. Perhaps you could check if terraform init was run and then report an issue?
Error: terraform not initialized: no modules found in .terraform/modules directory: stat /home/marko/comns/aws-bedrock-kendra-s3-and-streamlit/infra/.terraform/modules/modules.json: no such file or directory
  • init should probably be idempotent operation and running it again shouldn't error out:
Error: .terraform.module.hcl file already exists
  • Confirming changes should probably accept y as well as yes
  • Is adding a new module part of upgrade operation? Maybe it's a future feature but currently doesn't seem there is a path for this and summary is reporting on this.
@ned1313
Copy link
Owner

ned1313 commented Jun 12, 2024

@mbevc1

  • for init on empty module list, I agree that a warning would be more appropriate than an error. Long term, if there is no modules.json file, I'd like to check and see if there are any external modules in the config. If there are, prompt the user to run terraform init. If not, let the user know that no external modules are found in the configuration with a warning.
  • for idempotency on init I guess, init could run check in the background and see if there's any divergence. If check returns changes, then init should prompt the user to run upgrade. Otherwise, it could signal to the use that no changes are required.
  • Agreed on accepting y as well as yes
  • Adding a new module or updating existing modules is all part of the upgrade operation. Do you have a suggestion for a different workflow?
    • One possibility is that new modules are added using init and changing existing modules happens with upgrade. Does that workflow make more sense?

@ned1313 ned1313 mentioned this issue Jun 12, 2024
@ned1313
Copy link
Owner

ned1313 commented Jun 12, 2024

First three bullet points are addressed by PR #14

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

No branches or pull requests

2 participants