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

Update docs with new workspace commands #721

Merged
merged 3 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,79 @@ can be used to hint the user e.g. where to run `init` or `validate` from.
}
```

### `module.calls`

List of module which are called from the current module.
dbanck marked this conversation as resolved.
Show resolved Hide resolved

**Arguments:**

- `uri` - URI of the directory of the module in question, e.g. `file:///path/to/network`

**Outputs:**

- `v` - describes version of the format; Will be used in the future to communicate format changes.
- `module_calls` - array of modules which are called from the module in question
- `name` - a unique identifier for this particular module
dbanck marked this conversation as resolved.
Show resolved Hide resolved
- `source_addr` - the source address given for this module in configuration
dbanck marked this conversation as resolved.
Show resolved Hide resolved
- `version` - the exact version of the module
dbanck marked this conversation as resolved.
Show resolved Hide resolved
- `source_type` - source of the Terraform module, e.g. github or tfregistry
dbanck marked this conversation as resolved.
Show resolved Hide resolved
- `docs_link` - a link to the module documentation; if available
- `dependent_modules` - array of dependent modules with the same structure as `module_calls`

```json
{
"v": 0,
"module_calls": [
{
"name": "child",
"source_addr": "./child",
"source_type": "local",
"dependent_modules": []
},
{
"name": "vpc",
"source_addr": "terraform-aws-modules/vpc/aws",
"version": "3.11.0",
"source_type": "tfregistry",
"docs_link": "https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/3.11.0",
"dependent_modules": []
}
]
}
```

### `module.providers`

Provides information about the providers of the current module, including requirements and
installed version.

**Arguments:**

- `uri` - URI of the directory of the module in question, e.g. `file:///path/to/network`

**Outputs:**

- `v` - describes version of the format; Will be used in the future to communicate format changes.
- `provider_requirements` - map of provider FQN string to requirements object
- `display_name` - a user-friendly FQN string, simplified for readability
dbanck marked this conversation as resolved.
Show resolved Hide resolved
- `version_constraint` - a comma-separated list of version constraints
dbanck marked this conversation as resolved.
Show resolved Hide resolved
- `docs_link` - a link to the provider documentation; if available
- `installed_providers` - map of provider FQN string to installed version string; can be empty if none installed
dbanck marked this conversation as resolved.
Show resolved Hide resolved

```json
{
"v": 0,
"provider_requirements": {
"registry.terraform.io/hashicorp/aws": {
"display_name": "hashicorp/aws",
"version_constraint": "~> 3.64.0",
"docs_link": "https://registry.terraform.io/providers/hashicorp/aws/latest"
}
},
"installed_providers": {
"registry.terraform.io/hashicorp/aws": "3.64.2"
}
}
```

### `rootmodules` (DEPRECATED, use `module.callers` instead)
2 changes: 1 addition & 1 deletion internal/langserver/handlers/command/module_calls.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func parseModuleRecords(records []datadir.ModuleRecord) []moduleCall {
subModuleName := ""

// determine if this module is nested in another module
// in the currecnt workspace by finding a period in the moduleName
// in the current workspace by finding a period in the moduleName
dbanck marked this conversation as resolved.
Show resolved Hide resolved
// is it better to look at SourceAddr and compare?
if strings.Contains(manifest.Key, ".") {
v := strings.Split(manifest.Key, ".")
Expand Down