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

Modules invoked with missing required parameters #1186

Closed
mromascanu123 opened this issue Apr 10, 2024 · 2 comments
Closed

Modules invoked with missing required parameters #1186

mromascanu123 opened this issue Apr 10, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@mromascanu123
Copy link

TL;DR

When invoking some library modules required parameters not passed. It might work if the declared parameters (in variables.tf of the module) endup by actually not being used for reasons of "example" code or disabled sections. But not sure what is the general opinion regarding this coding practice, which I would abstain to qualify in my own words.

See as an example (among many) the attached screenshot exemplifying a call to project-factory with missing required parameters in 1-org/envs/shared/projects.tf.

Expected behavior

Required parameters with valid values should be passed to the modules requiring them, regardless whether actually being used in a particular instance of a module

Observed behavior

The deployment "seems" to work although with many warnings - can't tell anything about actual vs expected resources being deployed

Terraform Configuration

See screenshot as an example, it is a matter of code not configuration

Terraform Version

terraform version
Terraform v1.6.0
on linux_amd64

Your version of Terraform is out of date! The latest version
is 1.8.0.

Additional information

missing-params

@daniel-cit
Copy link
Contributor

Thanks for your report of this issue.

The Terraform configuration is valid as validated by terraform validate

image

Regarding the list of missing required variables in the screenshot most of then are not part of the project-factory module variable list like admin_email, amount, and api_sa_group among others.

For the ones that are part of the module like domain, they do have a default value

https://github.com/terraform-google-modules/terraform-google-project-factory/blob/v14.0.0/variables.tf#L34C1-L38C2
image

The official Terraform documentation regarding input variables, states that variables with a default value are optional (not required)

image

image

Reported behavior looks like an issue in the the configuration of the VSCode extension for Terraform,
possibly related to this issue fix: Work around 'unreliable' input data for Registry modules
or a similar one in the terraform-ls extension for VSCode provided by HashiCorp since running terraform validate proves that the configuration is valid.

Updating the VSCode extension for Terraform to use the latest release should be able to solve this issue.

@eeaton
Copy link
Collaborator

eeaton commented May 16, 2024

Thanks Daniel, I agree with this explanation that it looks like a configuration issue on the IDE and not a bug in this repo's code. I'll close this issue, please re-open if there are further concerns.

@eeaton eeaton closed this as completed May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants