Skip to content

Commit ffc8102

Browse files
committed
feat: add factory support
Add support for Image Factory resources. Fixes: #144 Fixes: #114 (via talos bump) Signed-off-by: Noel Georgi <[email protected]>
1 parent d6c2a0b commit ffc8102

21 files changed

+1214
-48
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "talos_image_factory_extensions_versions Data Source - talos"
4+
subcategory: ""
5+
description: |-
6+
The image factory extensions versions data source provides a list of available extensions for a specific talos version from the image factory.
7+
---
8+
9+
# talos_image_factory_extensions_versions (Data Source)
10+
11+
The image factory extensions versions data source provides a list of available extensions for a specific talos version from the image factory.
12+
13+
## Example Usage
14+
15+
```terraform
16+
provider "talos" {}
17+
18+
data "talos_image_factory_extensions_versions" "this" {
19+
# get the latest talos version
20+
talos_version = "v1.7.5"
21+
filters = {
22+
names = [
23+
"amdgpu",
24+
"tailscale",
25+
]
26+
}
27+
}
28+
```
29+
30+
<!-- schema generated by tfplugindocs -->
31+
## Schema
32+
33+
### Required
34+
35+
- `talos_version` (String) The talos version to get extensions for.
36+
37+
### Optional
38+
39+
- `filters` (Attributes) The filter to apply to the extensions list. (see [below for nested schema](#nestedatt--filters))
40+
41+
### Read-Only
42+
43+
- `extensions_info` (List of Object) The list of available extensions for the specified talos version. (see [below for nested schema](#nestedatt--extensions_info))
44+
- `id` (String) The ID of this resource.
45+
46+
<a id="nestedatt--filters"></a>
47+
### Nested Schema for `filters`
48+
49+
Optional:
50+
51+
- `names` (List of String) The name of the extension to filter by.
52+
53+
54+
<a id="nestedatt--extensions_info"></a>
55+
### Nested Schema for `extensions_info`
56+
57+
Read-Only:
58+
59+
- `author` (String)
60+
- `description` (String)
61+
- `digest` (String)
62+
- `name` (String)
63+
- `ref` (String)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "talos_image_factory_overlays_versions Data Source - talos"
4+
subcategory: ""
5+
description: |-
6+
The image factory overlays versions data source provides a list of available overlays for a specific talos version from the image factory.
7+
---
8+
9+
# talos_image_factory_overlays_versions (Data Source)
10+
11+
The image factory overlays versions data source provides a list of available overlays for a specific talos version from the image factory.
12+
13+
## Example Usage
14+
15+
```terraform
16+
provider "talos" {}
17+
18+
data "talos_image_factory_overlays_versions" "this" {
19+
# get the latest talos version
20+
talos_version = "v1.7.5"
21+
filters = {
22+
name = "rock4cplus"
23+
}
24+
}
25+
```
26+
27+
<!-- schema generated by tfplugindocs -->
28+
## Schema
29+
30+
### Required
31+
32+
- `talos_version` (String) The talos version to get overlays for.
33+
34+
### Optional
35+
36+
- `filters` (Attributes) The filter to apply to the overlays list. (see [below for nested schema](#nestedatt--filters))
37+
38+
### Read-Only
39+
40+
- `id` (String) The ID of this resource.
41+
- `overlays_info` (List of Object) The list of available extensions for the specified talos version. (see [below for nested schema](#nestedatt--overlays_info))
42+
43+
<a id="nestedatt--filters"></a>
44+
### Nested Schema for `filters`
45+
46+
Optional:
47+
48+
- `name` (String) The name of the overlay to filter by.
49+
50+
51+
<a id="nestedatt--overlays_info"></a>
52+
### Nested Schema for `overlays_info`
53+
54+
Read-Only:
55+
56+
- `digest` (String)
57+
- `image` (String)
58+
- `name` (String)
59+
- `ref` (String)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "talos_image_factory_versions Data Source - talos"
4+
subcategory: ""
5+
description: |-
6+
The image factory versions data source provides a list of available talos versions from the image factory.
7+
---
8+
9+
# talos_image_factory_versions (Data Source)
10+
11+
The image factory versions data source provides a list of available talos versions from the image factory.
12+
13+
## Example Usage
14+
15+
```terraform
16+
provider "talos" {}
17+
18+
data "talos_image_factory_versions" "this" {}
19+
20+
output "latest" {
21+
value = element(data.talos_image_factory_versions.this.talos_versions, length(data.talos_image_factory_versions.this.talos_versions) - 1)
22+
}
23+
```
24+
25+
<!-- schema generated by tfplugindocs -->
26+
## Schema
27+
28+
### Read-Only
29+
30+
- `id` (String) The ID of this resource.
31+
- `talos_versions` (List of String) The list of available talos versions.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
page_title: "talos_image_factory_schematic Resource - talos"
3+
subcategory: ""
4+
description: |-
5+
The image factory schematic resource allows you to create a schematic for a Talos image.
6+
---
7+
8+
# talos_image_factory_schematic (Resource)
9+
10+
The image factory schematic resource allows you to create a schematic for a Talos image.
11+
12+
## Example Usage
13+
14+
```terraform
15+
provider "talos" {}
16+
17+
data "talos_image_factory_extensions_versions" "this" {
18+
# get the latest talos version
19+
talos_version = "v1.7.5"
20+
filters = {
21+
names = [
22+
"amdgpu",
23+
"tailscale",
24+
]
25+
}
26+
}
27+
28+
resource "talos_image_factory_schematic" "this" {
29+
schematic = yamlencode(
30+
{
31+
customization = {
32+
systemExtensions = {
33+
officialExtensions = data.talos_image_factory_extensions_versions.this.extensions_info.*.name
34+
}
35+
}
36+
}
37+
)
38+
}
39+
40+
output "schematic_id" {
41+
value = talos_image_factory_schematic.this.id
42+
}
43+
```
44+
<!-- schema generated by tfplugindocs -->
45+
## Schema
46+
47+
### Optional
48+
49+
- `schematic` (String) The schematic yaml respresentation to generate the image.
50+
51+
If not set, a vanilla Talos image schematic will be generated.
52+
53+
> Refer to [image-factory](https://github.com/siderolabs/image-factory?tab=readme-ov-file#post-schematics) for the schema.
54+
55+
### Read-Only
56+
57+
- `id` (String) The unique ID of the schematic, returned from Image Factory.
58+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
provider "talos" {}
2+
3+
data "talos_image_factory_extensions_versions" "this" {
4+
# get the latest talos version
5+
talos_version = "v1.7.5"
6+
filters = {
7+
names = [
8+
"amdgpu",
9+
"tailscale",
10+
]
11+
}
12+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
provider "talos" {}
2+
3+
data "talos_image_factory_overlays_versions" "this" {
4+
# get the latest talos version
5+
talos_version = "v1.7.5"
6+
filters = {
7+
name = "rock4cplus"
8+
}
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
provider "talos" {}
2+
3+
data "talos_image_factory_versions" "this" {}
4+
5+
output "latest" {
6+
value = element(data.talos_image_factory_versions.this.talos_versions, length(data.talos_image_factory_versions.this.talos_versions) - 1)
7+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
provider "talos" {}
2+
3+
data "talos_image_factory_extensions_versions" "this" {
4+
# get the latest talos version
5+
talos_version = "v1.7.5"
6+
filters = {
7+
names = [
8+
"amdgpu",
9+
"tailscale",
10+
]
11+
}
12+
}
13+
14+
resource "talos_image_factory_schematic" "this" {
15+
schematic = yamlencode(
16+
{
17+
customization = {
18+
systemExtensions = {
19+
officialExtensions = data.talos_image_factory_extensions_versions.this.extensions_info.*.name
20+
}
21+
}
22+
}
23+
)
24+
}
25+
26+
output "schematic_id" {
27+
value = talos_image_factory_schematic.this.id
28+
}

go.mod

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@ go 1.22.5
55
require (
66
github.com/dustin/go-humanize v1.0.1
77
github.com/hashicorp/terraform-plugin-docs v0.19.4
8-
github.com/hashicorp/terraform-plugin-framework v1.9.0
8+
github.com/hashicorp/terraform-plugin-framework v1.10.0
99
github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1
10-
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0
10+
github.com/hashicorp/terraform-plugin-framework-validators v0.13.0
1111
github.com/hashicorp/terraform-plugin-go v0.23.0
1212
github.com/hashicorp/terraform-plugin-log v0.9.0
1313
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0
14-
github.com/hashicorp/terraform-plugin-testing v1.8.0
14+
github.com/hashicorp/terraform-plugin-testing v1.9.0
1515
github.com/siderolabs/crypto v0.4.4
1616
github.com/siderolabs/gen v0.5.0
1717
github.com/siderolabs/go-blockdevice v0.4.7
18+
github.com/siderolabs/image-factory v0.4.2
1819
github.com/siderolabs/net v0.4.0
19-
github.com/siderolabs/talos v1.8.0-alpha.1.0.20240711162129-a727a1d97a22
20+
github.com/siderolabs/talos v1.8.0-alpha.1.0.20240716094326-980f9ebc0725
2021
github.com/siderolabs/talos/pkg/machinery v1.8.0-alpha.1
2122
github.com/stretchr/testify v1.9.0
2223
golang.org/x/mod v0.19.0
@@ -58,18 +59,18 @@ require (
5859
github.com/containernetworking/cni v1.2.2 // indirect
5960
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
6061
github.com/distribution/reference v0.6.0 // indirect
61-
github.com/emicklei/go-restful/v3 v3.11.2 // indirect
62+
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
6263
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
6364
github.com/fatih/color v1.17.0 // indirect
6465
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
6566
github.com/ghodss/yaml v1.0.0 // indirect
6667
github.com/go-logr/logr v1.4.2 // indirect
67-
github.com/go-openapi/jsonpointer v0.20.2 // indirect
68-
github.com/go-openapi/jsonreference v0.20.4 // indirect
69-
github.com/go-openapi/swag v0.22.9 // indirect
68+
github.com/go-openapi/jsonpointer v0.21.0 // indirect
69+
github.com/go-openapi/jsonreference v0.21.0 // indirect
70+
github.com/go-openapi/swag v0.23.0 // indirect
7071
github.com/gogo/protobuf v1.3.2 // indirect
7172
github.com/golang/protobuf v1.5.4 // indirect
72-
github.com/google/gnostic-models v0.6.8 // indirect
73+
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
7374
github.com/google/go-cmp v0.6.0 // indirect
7475
github.com/google/gofuzz v1.2.0 // indirect
7576
github.com/google/uuid v1.6.0 // indirect
@@ -84,7 +85,7 @@ require (
8485
github.com/hashicorp/go-uuid v1.0.3 // indirect
8586
github.com/hashicorp/go-version v1.7.0 // indirect
8687
github.com/hashicorp/hc-install v0.7.0 // indirect
87-
github.com/hashicorp/hcl/v2 v2.20.1 // indirect
88+
github.com/hashicorp/hcl/v2 v2.21.0 // indirect
8889
github.com/hashicorp/logutils v1.0.0 // indirect
8990
github.com/hashicorp/terraform-exec v0.21.0 // indirect
9091
github.com/hashicorp/terraform-json v0.22.1 // indirect
@@ -129,7 +130,7 @@ require (
129130
github.com/siderolabs/go-pointer v1.0.0 // indirect
130131
github.com/siderolabs/go-procfs v0.1.2 // indirect
131132
github.com/siderolabs/go-retry v0.3.3 // indirect
132-
github.com/spf13/cast v1.5.0 // indirect
133+
github.com/spf13/cast v1.6.0 // indirect
133134
github.com/spf13/cobra v1.8.1 // indirect
134135
github.com/spf13/pflag v1.0.5 // indirect
135136
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
@@ -140,13 +141,13 @@ require (
140141
github.com/yuin/goldmark-meta v1.1.0 // indirect
141142
github.com/zclconf/go-cty v1.14.4 // indirect
142143
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
143-
golang.org/x/crypto v0.24.0 // indirect
144+
golang.org/x/crypto v0.25.0 // indirect
144145
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
145146
golang.org/x/net v0.26.0 // indirect
146147
golang.org/x/oauth2 v0.21.0 // indirect
147148
golang.org/x/sync v0.7.0 // indirect
148149
golang.org/x/sys v0.22.0 // indirect
149-
golang.org/x/term v0.21.0 // indirect
150+
golang.org/x/term v0.22.0 // indirect
150151
golang.org/x/text v0.16.0 // indirect
151152
golang.org/x/time v0.5.0 // indirect
152153
golang.org/x/tools v0.22.0 // indirect

0 commit comments

Comments
 (0)