env0 / terraform-provider-env0

Terraform Provider for env0

Home Page:https://env0.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Filter out more redundant scopes from `ConfigurationVariablesByScope`

Wassap124 opened this issue · comments

Is your feature request related to a problem? Please describe.
This bit of code supposedly filters out variables from scoped which weren't requested (as the request made returns "merged" variables from cascading scopes).

But, the code only filters out organization and template scope variables explicitly.

Describe the solution you'd like
Filter out all variables from unrequested scopes (using the scopeId field).

Describe alternatives you've considered
You could explicitly filter out all the project variables received which were not from the specifically requested project, but at that point i think the code is too messy and specific for no reason.

Additional context
This is requested alongside an effort to make variables from parent projects cascade throughout all of their sub-projects.
Since we want the provider to keep its behaviour and not get "new" values from ancestor projects' variables, we need to filter those out as well