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

module.callers: Use configuration as source of truth & indicate initialization #1001

Open
radeksimko opened this issue Jul 14, 2022 · 0 comments
Labels
enhancement New feature or request modules Functionality related to the module block and modules generally

Comments

@radeksimko
Copy link
Member

radeksimko commented Jul 14, 2022

Background

Currently clients use module.callers command to obtain a list of callers (if any) to help users choose where to run apply or validate since these commands cannot run without prior init.

Additionally clients may also use this list as a list of paths where the user may decide to run init.

Currently module.callers reports initialized module callers (as the data was read from .terraform directory). This is only useful for apply or validate, not so much for init as clients can offer locations which to re-initialize, but not entirely uninitialized directories.

It would still be useful if the client knew which module are initialized however, i.e. in which ones the user can run apply or validate.

Proposal

Update module.callers response, such that we report is_initialized: bool in addition to the URI of the module.

Implementation Notes

Terraform CLI defines "initialized" module as one which

  • has all modules installed (as per modules.json manifest) and matching the constraints in the config
  • has all providers installed - by comparing the lock file with binaries under .terraform

It may be useful to address the following issues first:

@radeksimko radeksimko added the enhancement New feature or request label Jul 14, 2022
@radeksimko radeksimko changed the title module.callers: Indicate whether a module caller is initialised module.callers: Use configuration as source of truth & indicate initialisation Jul 18, 2022
@radeksimko radeksimko changed the title module.callers: Use configuration as source of truth & indicate initialisation module.callers: Use configuration as source of truth & indicate initialization Jul 18, 2022
@xiehan xiehan added the modules Functionality related to the module block and modules generally label Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request modules Functionality related to the module block and modules generally
Projects
None yet
Development

No branches or pull requests

2 participants