Skip to content

Commit 1a41931

Browse files
committed
Add featureRequestURL support for yet to be features
Add an optional featureRequestURL field to FeatureToolData and Feature that links to an open issue or RFC when a tool does not yet support a feature. The table renders a ? link in place of - for these entries.
1 parent a948b97 commit 1a41931

6 files changed

Lines changed: 98 additions & 18 deletions

File tree

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Hugo version is pinned via `.tool-versions` (hugo 0.135.0). Install with `asdf i
3030

3131
## Data Schema
3232

33-
Each tool entry has: `version`, `versionURL`, `license`, `licenseURL`, `registry`, and `features[]`. Each feature has `name`, `version`, and optional `url`. Feature names are matched by string equality across tools to build the comparison table — a feature present in one tool but not the other renders as `-`.
33+
Each tool entry has: `version`, `versionURL`, `license`, `licenseURL`, `registry`, and `features[]`. Each feature has `name` (required), and optional `version`, `url`, and `featureRequestURL`. Feature names are matched by string equality across tools to build the comparison table — a feature present in one tool but not the other renders as `-`. A `featureRequestURL` with no `version` renders as a `?` link.
3434

3535
## Deployment
3636

README.md

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,75 @@ As time passes, OpenTofu and Terraform become more distant from each other. [Can
44

55
## Add new features
66

7-
To add new features, edit the JSON in the tool's variable inside `main.go`.
8-
The entry should include the feature's name, the released version, and an optionable URL to its documentation.
9-
If the entry is valid for both tools, use the same name.
10-
Run `go run main.go` to validate the changes against the schema and replace the source of truth `data/tools.json`.
7+
The `tools/tools.yaml` file is the source of truth. Then run `go run main.go` to validate and regenerate `data/tools.json` and `static/tools.json`.
8+
9+
### `tools/tools.yaml` structure
10+
11+
The file has two top-level keys:
12+
13+
#### `tools`
14+
15+
Metadata for each tool. Displayed in the header rows of the comparison table.
16+
17+
```yaml
18+
tools:
19+
opentofu:
20+
version: "1.11"
21+
versionURL: https://github.com/opentofu/opentofu/releases/latest
22+
license: MPL-2.0
23+
licenseURL: https://github.com/opentofu/opentofu/blob/main/LICENSE
24+
registry: https://search.opentofu.org/
25+
```
26+
27+
#### `features`
28+
29+
Each tool entry under a feature supports three optional fields:
30+
31+
| Field | Description |
32+
|---------------------|-----------------------------------------------------------------------------|
33+
| `version` | The version that introduced the feature (e.g. `"1.9"`). |
34+
| `url` | URL to the feature's documentation. Renders the version as a link. |
35+
| `featureRequestURL` | URL to an open issue or RFC tracking the feature. Renders as a `?` link when the feature is not yet supported (i.e. no `version`). |
36+
37+
**Feature supported by both tools:**
38+
```yaml
39+
- name: State encryption
40+
tools:
41+
opentofu:
42+
version: "1.7"
43+
url: https://opentofu.org/docs/language/state/encryption/
44+
terraform:
45+
version: "1.9"
46+
url: https://developer.hashicorp.com/terraform/language/state/encryption
47+
```
48+
49+
**Feature supported by one tool only (renders `-` for the other):**
50+
```yaml
51+
- name: State encryption
52+
tools:
53+
opentofu:
54+
version: "1.7"
55+
url: https://opentofu.org/docs/language/state/encryption/
56+
```
57+
58+
**Feature not yet supported, with a tracking link:**
59+
```yaml
60+
- name: Some upcoming feature
61+
tools:
62+
opentofu:
63+
version: "1.9"
64+
url: https://opentofu.org/docs/...
65+
terraform:
66+
featureRequestURL: https://github.com/hashicorp/terraform/issues/123
67+
```
1168

1269
## Local development
1370

1471
```
1572
$ # Install hugo
1673
$ asdf plugin add hugo
1774
$ asdf install
18-
$ # hugo server --buildDrafts --disableFastRender
19-
$ # HTML in layouts/_default
75+
$ go run main.go
76+
$ hugo server --buildDrafts --disableFastRender
77+
$ # HTML templates are in layouts/_default
2078
```

data/tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,4 @@
183183
}
184184
]
185185
}
186-
}
186+
}

layouts/_default/home.html

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,25 @@ <h1><a href="https://cani.tf/">Can I TF</a></h1>
5151
<td>{{ $opentofuFeature.name }}</td>
5252
{{- if $opentofuFeature.url }}
5353
<td><a href="{{ $opentofuFeature.url }}">{{ $opentofuFeature.version }}</a></td>
54-
{{ else }}
54+
{{ else if $opentofuFeature.version }}
5555
<td>{{ $opentofuFeature.version }}</td>
56+
{{ else if $opentofuFeature.featureRequestURL }}
57+
<td><a href="{{ $opentofuFeature.featureRequestURL }}">?</a></td>
58+
{{ else }}
59+
<td>-</td>
5660
{{ end -}}
5761

5862
{{- /* Check for matching Terraform feature */ -}}
5963
{{- if gt (len $matchingTerraformFeatures) 0 -}}
6064
{{- $matchingTerraformFeature := index $matchingTerraformFeatures 0 -}}
6165
{{- if $matchingTerraformFeature.url }}
6266
<td><a href="{{ $matchingTerraformFeature.url }}">{{ $matchingTerraformFeature.version }}</a></td>
63-
{{ else }}
67+
{{ else if $matchingTerraformFeature.version }}
6468
<td>{{ $matchingTerraformFeature.version }}</td>
69+
{{ else if $matchingTerraformFeature.featureRequestURL }}
70+
<td><a href="{{ $matchingTerraformFeature.featureRequestURL }}">?</a></td>
71+
{{ else }}
72+
<td>-</td>
6573
{{ end -}}
6674
{{ else -}}
6775
<td>-</td>
@@ -80,7 +88,15 @@ <h1><a href="https://cani.tf/">Can I TF</a></h1>
8088
<tr>
8189
<td>{{ $terraformFeature.name }}</td>
8290
<td>-</td>
91+
{{- if $terraformFeature.url }}
8392
<td><a href="{{ $terraformFeature.url }}">{{ $terraformFeature.version }}</a></td>
93+
{{ else if $terraformFeature.version }}
94+
<td>{{ $terraformFeature.version }}</td>
95+
{{ else if $terraformFeature.featureRequestURL }}
96+
<td><a href="{{ $terraformFeature.featureRequestURL }}">?</a></td>
97+
{{ else }}
98+
<td>-</td>
99+
{{ end }}
84100
</tr>
85101
{{ end -}}
86102
{{ end -}}

main.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,13 @@ var schemaData = []byte(`{
5252
"version": {
5353
"type": "string",
5454
"maxLength": 4
55+
},
56+
"featureRequestURL": {
57+
"type": "string",
58+
"format": "uri"
5559
}
5660
},
57-
"required": ["name", "version"]
61+
"required": ["name"]
5862
}
5963
}
6064
},
@@ -64,9 +68,10 @@ var schemaData = []byte(`{
6468
}`)
6569

6670
type Feature struct {
67-
Name string `json:"name" yaml:"name"`
68-
Version string `json:"version" yaml:"version"`
69-
URL string `json:"url,omitempty" yaml:"url,omitempty"`
71+
Name string `json:"name" yaml:"name"`
72+
Version string `json:"version,omitempty" yaml:"version,omitempty"`
73+
URL string `json:"url,omitempty" yaml:"url,omitempty"`
74+
FeatureRequestURL string `json:"featureRequestURL,omitempty" yaml:"featureRequestURL,omitempty"`
7075
}
7176

7277
type Tool struct {
@@ -87,8 +92,9 @@ type ToolMeta struct {
8792
}
8893

8994
type FeatureToolData struct {
90-
Version string `yaml:"version"`
91-
URL string `yaml:"url,omitempty"`
95+
Version string `yaml:"version,omitempty"`
96+
URL string `yaml:"url,omitempty"`
97+
FeatureRequestURL string `yaml:"featureRequestURL,omitempty"`
9298
}
9399

94100
type FeatureEntry struct {
@@ -124,7 +130,7 @@ func main() {
124130
for _, f := range tf.Features {
125131
for toolName, fd := range f.Tools {
126132
t := tools[toolName]
127-
t.Features = append(t.Features, Feature{Name: f.Name, Version: fd.Version, URL: fd.URL})
133+
t.Features = append(t.Features, Feature{Name: f.Name, Version: fd.Version, URL: fd.URL, FeatureRequestURL: fd.FeatureRequestURL})
128134
tools[toolName] = t
129135
}
130136
}

static/tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,4 @@
183183
}
184184
]
185185
}
186-
}
186+
}

0 commit comments

Comments
 (0)