Skip to content

Commit 8e30940

Browse files
committed
docs: regenerate documentation after rebase on master
1 parent 5c6e49a commit 8e30940

File tree

2 files changed

+103
-26
lines changed

2 files changed

+103
-26
lines changed

docs/resources/key_manager_key.md

Lines changed: 61 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,80 @@ This resource allows you to create and manage cryptographic keys in Scaleway Key
99

1010
## Example Usage
1111

12+
### Symmetric Encryption Key
13+
1214
```terraform
13-
resource "scaleway_key_manager_key" "main" {
14-
name = "my-kms-key"
15-
region = "fr-par"
16-
project_id = "your-project-id" # optional, will use provider default if omitted
17-
usage = "symmetric_encryption"
18-
description = "Key for encrypting secrets"
19-
tags = ["env:prod", "kms"]
20-
unprotected = true
15+
resource "scaleway_key_manager_key" "symmetric" {
16+
name = "my-kms-key"
17+
region = "fr-par"
18+
project_id = "your-project-id" # optional, will use provider default if omitted
19+
usage = "symmetric_encryption"
20+
algorithm = "aes_256_gcm"
21+
description = "Key for encrypting secrets"
22+
tags = ["env:prod", "kms"]
23+
unprotected = true
2124
2225
rotation_policy {
2326
rotation_period = "720h" # 30 days
2427
}
2528
}
2629
```
2730

31+
### Asymmetric Encryption Key with RSA-4096
32+
33+
```terraform
34+
resource "scaleway_key_manager_key" "rsa_4096" {
35+
name = "rsa-4096-key"
36+
region = "fr-par"
37+
usage = "asymmetric_encryption"
38+
algorithm = "rsa_oaep_4096_sha256"
39+
description = "Key for encrypting large files with RSA-4096"
40+
unprotected = true
41+
}
42+
```
43+
44+
### Asymmetric Signing Key
45+
46+
```terraform
47+
resource "scaleway_key_manager_key" "signing" {
48+
name = "signing-key"
49+
region = "fr-par"
50+
usage = "asymmetric_signing"
51+
algorithm = "rsa_pss_2048_sha256"
52+
description = "Key for signing documents"
53+
unprotected = true
54+
}
55+
```
56+
2857
## Argument Reference
2958

3059
The following arguments are supported:
3160

3261
- `name` (String) – The name of the key.
3362
- `region` (String) – The region in which to create the key (e.g., `fr-par`).
34-
- `project_id` (String, Optional) – The ID of the project the key belongs to.
35-
- `usage` (String, **Required**) – The usage of the key. Valid values are:
36-
- `symmetric_encryption`
37-
- `asymmetric_encryption`
38-
- `asymmetric_signing`
63+
- `project_id` (String, Optional) – The ID of the project the key belongs to.
64+
65+
**Key Usage and Algorithm (both required):**
66+
67+
- `usage` (String, Required) – The usage type of the key. Valid values:
68+
- `symmetric_encryption` – For symmetric encryption operations
69+
- `asymmetric_encryption` – For asymmetric encryption operations
70+
- `asymmetric_signing` – For digital signing operations
71+
72+
- `algorithm` (String, Required) – The cryptographic algorithm to use. Valid values depend on the `usage`:
73+
- For `symmetric_encryption`:
74+
- `aes_256_gcm`
75+
- For `asymmetric_encryption`:
76+
- `rsa_oaep_2048_sha256`
77+
- `rsa_oaep_3072_sha256`
78+
- `rsa_oaep_4096_sha256`
79+
- For `asymmetric_signing`:
80+
- `ec_p256_sha256`
81+
- `rsa_pss_2048_sha256`
82+
- `rsa_pkcs1_2048_sha256`
83+
84+
**Other arguments:**
85+
3986
- `description` (String, Optional) – A description for the key.
4087
- `tags` (List of String, Optional) – A list of tags to assign to the key.
4188
- `unprotected` (Boolean, Optional) – If `true`, the key can be deleted. Defaults to `false` (protected).
@@ -57,8 +104,6 @@ In addition to all arguments above, the following attributes are exported:
57104
- `protected` – Whether the key is protected from deletion.
58105
- `locked` – Whether the key is locked.
59106
- `rotated_at` – The date and time when the key was last rotated.
60-
- `origin_read` – The origin of the key as returned by the API.
61-
- `region_read` – The region of the key as returned by the API.
62107
- `rotation_policy` (Block)
63108
- `rotation_period` – The period between key rotations.
64109
- `next_rotation_at` – The date and time of the next scheduled rotation.
@@ -77,15 +122,5 @@ terraform import scaleway_key_manager_key.main fr-par/11111111-2222-3333-4444-55
77122
- **Rotation Policy**: The `rotation_policy` block allows you to set automatic rotation for your key.
78123
- **Origin**: The `origin` argument is optional and defaults to `scaleway_kms`. Use `external` if you want to import an external key (see Scaleway documentation for details).
79124
- **Project and Region**: If not specified, `project_id` and `region` will default to the provider configuration.
125+
- **Algorithm Validation**: The provider validates that the specified `algorithm` is compatible with the `usage` type at plan time, providing early feedback on configuration errors.
80126

81-
## Example: Asymmetric Key
82-
83-
```terraform
84-
resource "scaleway_key_manager_key" "asym" {
85-
name = "asymmetric-key"
86-
region = "fr-par"
87-
usage = "asymmetric_signing"
88-
description = "Key for signing documents"
89-
unprotected = true
90-
}
91-
```

docs/template_test.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package template_test
2+
3+
import (
4+
"bufio"
5+
"io/fs"
6+
"os"
7+
"path/filepath"
8+
"regexp"
9+
"strings"
10+
"testing"
11+
)
12+
13+
var gotypeRE = regexp.MustCompile(`\{\{.*gotype:.*}}`)
14+
15+
func TestGoTypeDefined(t *testing.T) {
16+
err := filepath.WalkDir("resources", func(path string, _ fs.DirEntry, _ error) error {
17+
if isTemplate := strings.Contains(path, "tmpl"); isTemplate {
18+
f, err := os.Open(path)
19+
if err != nil {
20+
t.Fatalf("cannot open %s", path)
21+
}
22+
defer f.Close()
23+
24+
scanner := bufio.NewScanner(f)
25+
if !scanner.Scan() {
26+
t.Logf("❌ %s: file is empty", path)
27+
t.Fail()
28+
}
29+
firstLine := scanner.Text()
30+
if gotypeRE.MatchString(firstLine) {
31+
return nil
32+
}
33+
t.Logf("gotype missing at top of file: %s", path)
34+
t.Fail()
35+
}
36+
37+
return nil
38+
})
39+
if err != nil {
40+
return
41+
}
42+
}

0 commit comments

Comments
 (0)