Skip to content

Commit 8db5761

Browse files
Enhance documentation for connection and user resources with security warnings and examples
1 parent 891def2 commit 8db5761

File tree

4 files changed

+49
-9
lines changed

4 files changed

+49
-9
lines changed

docs/resources/connection.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,25 @@ Manages a connection in Kinde.
2323

2424
### Optional
2525

26-
- `options` (Attributes) Options for the connection. Required for OAuth2 connections. Sensitive values are stored in state and rely on state encryption for security. (see [below for nested schema](#nestedatt--options))
26+
- `options` (Attributes) Options for the connection. Required for OAuth2 connections.
27+
28+
**Warning:** Terraform state is not encrypted by default. The `client_id` and `client_secret` values are stored in state (even when marked as sensitive) and may be written to local state files and remote backends. Use an encrypted remote backend (for example Terraform Cloud/Enterprise, or S3 with `encrypt = true` and SSE-KMS).
29+
30+
Example (S3 backend with KMS):
31+
32+
~~~hcl
33+
terraform {
34+
backend "s3" {
35+
bucket = "my-tf-state"
36+
key = "kinde/terraform.tfstate"
37+
region = "us-east-1"
38+
encrypt = true
39+
kms_key_id = "arn:aws:kms:..."
40+
}
41+
}
42+
~~~
43+
44+
See: https://developer.hashicorp.com/terraform/language/state/sensitive-data (see [below for nested schema](#nestedatt--options))
2745

2846
### Read-Only
2947

docs/resources/user.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ Manages a user within a Kinde organization.
1717

1818
### Required
1919

20-
- `first_name` (String) The first name of the user.
2120
- `identities` (Attributes Set) Identities for the user (email, username, phone, etc.). (see [below for nested schema](#nestedatt--identities))
22-
- `last_name` (String) The last name of the user.
2321

2422
### Optional
2523

24+
- `first_name` (String) The first name of the user.
2625
- `is_suspended` (Boolean) Whether the user is suspended.
27-
- `organization_code` (String) The code of the organization the user belongs to.
26+
- `last_name` (String) The last name of the user.
27+
- `organization_code` (String) Organization code to create the user in. This value is sent to the API only on create and the API does not return it in read responses.
2828

2929
### Read-Only
3030

internal/provider/connection_resource.go

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,27 @@ func (r *ConnectionResource) Schema(_ context.Context, _ resource.SchemaRequest,
140140
Required: true,
141141
},
142142
"options": schema.SingleNestedAttribute{
143-
MarkdownDescription: "Options for the connection. Required for OAuth2 connections. Sensitive values are stored in state and rely on state encryption for security.",
144-
Optional: true,
145-
PlanModifiers: []planmodifier.Object{&optionsEmptyPreserveModifier{}},
143+
MarkdownDescription: `Options for the connection. Required for OAuth2 connections.
144+
145+
**Warning:** Terraform state is not encrypted by default. The ` + "`client_id`" + ` and ` + "`client_secret`" + ` values are stored in state (even when marked as sensitive) and may be written to local state files and remote backends. Use an encrypted remote backend (for example Terraform Cloud/Enterprise, or S3 with ` + "`encrypt = true`" + ` and SSE-KMS).
146+
147+
Example (S3 backend with KMS):
148+
149+
~~~hcl
150+
terraform {
151+
backend "s3" {
152+
bucket = "my-tf-state"
153+
key = "kinde/terraform.tfstate"
154+
region = "us-east-1"
155+
encrypt = true
156+
kms_key_id = "arn:aws:kms:..."
157+
}
158+
}
159+
~~~
160+
161+
See: https://developer.hashicorp.com/terraform/language/state/sensitive-data`,
162+
Optional: true,
163+
PlanModifiers: []planmodifier.Object{&optionsEmptyPreserveModifier{}},
146164
Attributes: map[string]schema.Attribute{
147165
"client_id": schema.StringAttribute{
148166
Optional: true,

internal/provider/user_resource.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,12 @@ func (r *UserResource) Schema(_ context.Context, _ resource.SchemaRequest, resp
7878
Description: "Whether the user is suspended.",
7979
},
8080
"organization_code": schema.StringAttribute{
81-
Optional: true,
82-
Description: "The code of the organization the user belongs to.",
81+
Optional: true,
82+
Description: "The code of the organization the user belongs to.",
83+
MarkdownDescription: "Organization code to create the user in. This value is sent to the API only on create and the API does not return it in read responses.",
84+
PlanModifiers: []planmodifier.String{
85+
stringplanmodifier.RequiresReplace(),
86+
},
8387
},
8488
"created_on": schema.StringAttribute{
8589
Description: "The timestamp when the user was created.",

0 commit comments

Comments
 (0)