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

[BUG] Is there anyway to handle terraform resources in nested child_modules ? #359

Open
1 of 5 tasks
Shinyaigeek opened this issue Oct 1, 2024 · 0 comments
Open
1 of 5 tasks
Assignees
Labels
bug Something isn't working

Comments

@Shinyaigeek
Copy link

Shinyaigeek commented Oct 1, 2024

Kind of proposals

  • Parser
  • Linter
  • Simulator
  • Testing
  • Terraform

Describe the problem

Currently, I am working to set up Fastly Deliver service with Terraform. My terraform project's directory structure is like below:

- terraform/
  - modules/: Define fastly service needed in my project as Terraform module. 
    - app/: accumulate fastly resources defined in `common/` as a single fastly service
    - common/: Define fastly resources
  - env/: Pass variables to fastly service defined in `modules/` according to it's environment
    - dev/
    - prod/

In the above directory structure, falco does not display any result in terraform -chdir terraform/env/${env} show -json planned.out | falco -vv terraform lint.

In my understanding, terraform will generate fastly resources in planned_values.root_module.child_modules.child_modules.resources on the output json by command terraform -chdir terraform/env/${env} show -json planned.out with the above terraform structure because of the module dependency env -> app -> common. In other word, fastly resources will be generated in nested child_modules.

for _, v := range root.PlannedValues.RootModule.ChildModules {

Currently, falco seems not to be able to handle nested child_resources as the code implies.

Is this behavior a bug? or Is there anyway to handle nested child_modules?

VCL code that cause the problem / reproduceable

- terraform/
  - modules/
    - app/
    - common/
  - env/
    - dev/
    - prod/

I can create the reproduction repository or provide with the json generated by terraform show -json if you want.

Expected behavior

falco can handle nested child_modules

Desktop (please complete the following information)

required

  • OS: M1 Mac
  • Shell: bash
@Shinyaigeek Shinyaigeek added the bug Something isn't working label Oct 1, 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

2 participants