Skip to content

Commit 55f2b93

Browse files
author
protobuf-ci-cd
committed
chore: add description
1 parent 3f0ed19 commit 55f2b93

File tree

1 file changed

+32
-29
lines changed

1 file changed

+32
-29
lines changed

internal/services/keymanager/key_resource.go

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,61 +24,66 @@ func ResourceKeyManagerKey() *schema.Resource {
2424
DeleteContext: resourceKeyManagerKeyDelete,
2525
Schema: map[string]*schema.Schema{
2626
"name": {
27-
Type: schema.TypeString,
28-
Optional: true,
27+
Type: schema.TypeString,
28+
Optional: true,
29+
Description: "Name of the key.",
2930
},
30-
"project_id": account.ProjectIDSchema(),
31-
"region": regional.Schema(),
31+
"project_id": account.ProjectIDSchema(), // ID of the Project containing the key.
32+
"region": regional.Schema(), // Region where the key is stored.
3233
"usage": {
3334
Type: schema.TypeString,
3435
Required: true,
3536
ValidateFunc: validation.StringInSlice([]string{
3637
"symmetric_encryption", "asymmetric_encryption", "asymmetric_signing",
3738
}, false),
39+
Description: "Key usage. Keys with a usage set to 'symmetric_encryption' can encrypt and decrypt data using the AES-256-GCM key algorithm. Possible values: symmetric_encryption, asymmetric_encryption, asymmetric_signing.",
3840
},
3941
"description": {
40-
Type: schema.TypeString,
41-
Optional: true,
42+
Type: schema.TypeString,
43+
Optional: true,
44+
Description: "Description of the key.",
4245
},
4346
"tags": {
44-
Type: schema.TypeList,
45-
Optional: true,
46-
Elem: &schema.Schema{Type: schema.TypeString},
47+
Type: schema.TypeList,
48+
Optional: true,
49+
Elem: &schema.Schema{Type: schema.TypeString},
50+
Description: "List of the key's tags.",
4751
},
4852
"rotation_policy": {
49-
Type: schema.TypeList,
50-
Optional: true,
51-
MaxItems: 1,
53+
Type: schema.TypeList,
54+
Optional: true,
55+
MaxItems: 1,
56+
Description: "Key rotation policy.",
5257
Elem: &schema.Resource{
5358
Schema: map[string]*schema.Schema{
54-
"rotation_period": {Type: schema.TypeString, Optional: true},
55-
"next_rotation_at": {Type: schema.TypeString, Computed: true},
59+
"rotation_period": {Type: schema.TypeString, Optional: true, Description: "Time interval between two key rotations. The minimum duration is 24 hours and the maximum duration is 1 year (876000 hours)."},
60+
"next_rotation_at": {Type: schema.TypeString, Computed: true, Description: "Timestamp indicating the next scheduled rotation."},
5661
},
5762
},
5863
},
5964
"unprotected": {
60-
Type: schema.TypeBool,
61-
Optional: true,
62-
Default: false,
65+
Type: schema.TypeBool,
66+
Optional: true,
67+
Default: false,
68+
Description: "If true, the key is not protected against deletion.",
6369
},
6470
"origin": {
6571
Type: schema.TypeString,
6672
Optional: true,
6773
ValidateFunc: validation.StringInSlice([]string{
6874
"scaleway_kms", "external",
6975
}, false),
76+
Description: "Origin of the key material. Possible values: scaleway_kms (Key Manager generates the key material), external (key material comes from an external source).",
7077
},
7178
// Computed fields
72-
"id": {Type: schema.TypeString, Computed: true},
73-
"state": {Type: schema.TypeString, Computed: true},
74-
"created_at": {Type: schema.TypeString, Computed: true},
75-
"updated_at": {Type: schema.TypeString, Computed: true},
76-
"rotation_count": {Type: schema.TypeInt, Computed: true},
77-
"protected": {Type: schema.TypeBool, Computed: true},
78-
"locked": {Type: schema.TypeBool, Computed: true},
79-
"rotated_at": {Type: schema.TypeString, Computed: true},
80-
"origin_read": {Type: schema.TypeString, Computed: true},
81-
"region_read": {Type: schema.TypeString, Computed: true},
79+
"id": {Type: schema.TypeString, Computed: true, Description: "ID of the key."},
80+
"state": {Type: schema.TypeString, Computed: true, Description: "State of the key. See the Key.State enum for possible values."},
81+
"created_at": {Type: schema.TypeString, Computed: true, Description: "Key creation date."},
82+
"updated_at": {Type: schema.TypeString, Computed: true, Description: "Key last modification date."},
83+
"rotation_count": {Type: schema.TypeInt, Computed: true, Description: "The rotation count tracks the number of times the key has been rotated."},
84+
"protected": {Type: schema.TypeBool, Computed: true, Description: "Returns true if key protection is applied to the key."},
85+
"locked": {Type: schema.TypeBool, Computed: true, Description: "Returns true if the key is locked."},
86+
"rotated_at": {Type: schema.TypeString, Computed: true, Description: "Key last rotation date."},
8287
},
8388
}
8489
}
@@ -177,8 +182,6 @@ func resourceKeyManagerKeyRead(ctx context.Context, d *schema.ResourceData, m an
177182
_ = d.Set("protected", key.Protected)
178183
_ = d.Set("locked", key.Locked)
179184
_ = d.Set("rotated_at", types.FlattenTime(key.RotatedAt))
180-
_ = d.Set("origin_read", key.Origin.String())
181-
_ = d.Set("region_read", key.Region.String())
182185

183186
if key.RotationPolicy != nil {
184187
var periodStr string

0 commit comments

Comments
 (0)