Skip to content

Commit a1afe5d

Browse files
author
protobuf-ci-cd
committed
add doc:
1 parent fd68b84 commit a1afe5d

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

docs/resources/key_manager_key.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
# scaleway_key_manager_key
3+
4+
Provides a Scaleway Key Manager Key resource.
5+
This resource allows you to create and manage cryptographic keys in Scaleway Key Manager (KMS).
6+
7+
## Example Usage
8+
9+
```hcl
10+
resource "scaleway_key_manager_key" "main" {
11+
name = "my-kms-key"
12+
region = "fr-par"
13+
project_id = "your-project-id" # optional, will use provider default if omitted
14+
usage = "symmetric_encryption"
15+
description = "Key for encrypting secrets"
16+
tags = ["env:prod", "kms"]
17+
unprotected = true
18+
19+
rotation_policy {
20+
rotation_period = "720h" # 30 days
21+
}
22+
}
23+
```
24+
25+
## Argument Reference
26+
27+
The following arguments are supported:
28+
29+
- `name` (String) – The name of the key.
30+
- `region` (String) – The region in which to create the key (e.g., `fr-par`).
31+
- `project_id` (String, Optional) – The ID of the project the key belongs to.
32+
- `usage` (String, **Required**) – The usage of the key. Valid values are:
33+
- `symmetric_encryption`
34+
- `asymmetric_encryption`
35+
- `asymmetric_signing`
36+
- `description` (String, Optional) – A description for the key.
37+
- `tags` (List of String, Optional) – A list of tags to assign to the key.
38+
- `unprotected` (Boolean, Optional) – If `true`, the key can be deleted. Defaults to `false` (protected).
39+
- `origin` (String, Optional) – The origin of the key. Valid values are:
40+
- `scaleway_kms` (default)
41+
- `external`
42+
- `rotation_policy` (Block, Optional) – Rotation policy for the key:
43+
- `rotation_period` (String, Optional) – The period between key rotations (e.g., `"720h"` for 30 days).
44+
45+
## Attributes Reference
46+
47+
In addition to the arguments above, the following attributes are exported:
48+
49+
- `id` – The ID of the key.
50+
- `state` – The state of the key (e.g., `enabled`).
51+
- `created_at` – The date and time when the key was created.
52+
- `updated_at` – The date and time when the key was last updated.
53+
- `rotation_count` – The number of times the key has been rotated.
54+
- `protected` – Whether the key is protected from deletion.
55+
- `locked` – Whether the key is locked.
56+
- `rotated_at` – The date and time when the key was last rotated.
57+
- `origin_read` – The origin of the key as returned by the API.
58+
- `region_read` – The region of the key as returned by the API.
59+
- `rotation_policy` (Block)
60+
- `rotation_period` – The period between key rotations.
61+
- `next_rotation_at` – The date and time of the next scheduled rotation.
62+
63+
## Import
64+
65+
You can import a key using its ID and region:
66+
67+
```shell
68+
terraform import scaleway_key_manager_key.main fr-par/11111111-2222-3333-4444-555555555555
69+
```
70+
71+
## Notes
72+
73+
- **Protection**: By default, keys are protected and cannot be deleted. To allow deletion, set `unprotected = true` when creating the key.
74+
- **Rotation Policy**: The `rotation_policy` block allows you to set automatic rotation for your key.
75+
- **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).
76+
- **Project and Region**: If not specified, `project_id` and `region` will default to the provider configuration.
77+
78+
## Example: Asymmetric Key
79+
80+
```hcl
81+
resource "scaleway_key_manager_key" "asym" {
82+
name = "asymmetric-key"
83+
region = "fr-par"
84+
usage = "asymmetric_signing"
85+
description = "Key for signing documents"
86+
unprotected = true
87+
}
88+
```
89+
90+
## See Also
91+
92+
- [Scaleway Key Manager documentation](https://www.scaleway.com/en/docs/security/key-manager/)
93+
- [Terraform Scaleway Provider documentation](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs)

0 commit comments

Comments
 (0)