Skip to content

Add ability to explicitly specify root modules as a workspace setting #396

@paultyng

Description

@paultyng

Users' should be able to manually override root modules for a given Terraform workspace or folder. The config should be scoped resource.

"terraform.rootModules": [
  "dir1",
  "dir2/dir3",
  "otherDir"
]

The paths should be relative to the root of the folders in the workspace (not sure if we want to allow for initialization outside workspace scope, maybe as a follow-on issue to investigate).

Given the above config and the following tree structure for a single workspace folder:

.
├── dir1
│   └── main.tf 
├── someDir
│       └── main.tf 
└── dir2
    ├── notRoot
    └── dir3
        └── main.tf 

The extension should enumerate all the directories in the setting that match actual directories present and pass those to the LS. In this case it would be:

[
  "dir1",
  "dir2/dir3"
]

(You'll notice otherDir is not passed as it doesn't match anything on disk, and someDir is not passed as its not in the settings).


Optionally we may also want to support per root module expanded configuration.

"terraform.rootModules": {
  "dir1": {
    "someSetting": ""
  }, 
  "dir2/dir3": {
    "someOtherSetting": ""
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions