# Version Resolution
adnv handles two version formats and resolves them differently depending on the source type.
## Version formats
### Semantic Versioning (SemVer)
Used by: Helm charts, Docker images, Git repositories, NPM packages.
Follows the [semver specification](https://semver.org/): `MAJOR.MINOR.PATCH` with optional pre-release and build metadata.
Examples: `1.0.0`, `2.3.1-rc.1`, `0.15.0+build.42`
### Terraform Versioning
Used by: Terraform modules, Terraform providers.
Follows Terraform's constraint syntax:
| `= 1.0.0` | Exact match | Only `1.0.0` |
| `!= 1.0.0` | Exclude | Any except `1.0.0` |
| `> 1.0.0` | Greater than | `1.0.1`, `2.0.0`, etc. |
| `>= 1.0.0` | Greater or equal | `1.0.0`, `1.0.1`, etc. |
| `~> 1.0` | Pessimistic (minor) | `>= 1.0, < 2.0` |
| `~> 1.0.0` | Pessimistic (patch) | `>= 1.0.0, < 1.1.0` |
## Resolution process
```mermaid
flowchart TD
A[Parse source from file] --> B{Has version constraint?}
B -->|No| C[Return latest version]
B -->|Yes| D[Fetch all available tags]
D --> E[Parse tags as versions]
E --> F[Sort by version descending]
F --> G[Find latest overall]
G --> H{Latest matches constraint?}
H -->|Yes| I[Up to date - skip]
H -->|No| J[Find best match for constraint]
J --> K[Return: wanted + latest]
```
## Key concepts
### Current version
The version currently specified in your file:
```hcl
module "vpc" {
version = "1.0.0" # current = 1.0.0
}
```
### Wanted version
The highest available version that satisfies your constraint:
```hcl
# Constraint: ~> 1.0
# Available: 1.0.0, 1.1.0, 1.2.0, 2.0.0
# Wanted: 1.2.0 (highest matching ~> 1.0)
```
### Latest version
The absolute highest available version, regardless of constraints:
```
# Latest: 2.0.0
```
### Display
| 1.0.0 | 1.2.0 | 1.2.0 | Outdated, update available within constraint |
| 1.0.0 | 1.2.0 | 2.0.0 | Outdated, new major available beyond constraint |
| 1.0.0 | 1.0.0 | 1.0.0 | Up to date (not shown) |
## What gets updated
The `update` command only modifies **fixed version strings**. Version ranges and constraints are left untouched:
```hcl
# Updated: fixed version
version = "1.0.0" → version = "1.2.0"
# NOT updated: version range
version = "~> 1.0" # stays as-is
```