Skip to content

Commit d354333

Browse files
committed
review changes 5 (improve note docs)
Signed-off-by: Mauritz Uphoff <mauritz.uphoff@stackit.cloud>
1 parent fcb84a8 commit d354333

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

docs/ephemeral-resources/access_token.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33
page_title: "stackit_access_token Ephemeral Resource - stackit"
44
subcategory: ""
55
description: |-
6-
Ephemeral resource that generates a short-lived STACKIT access token (JWT) using a service account key. A new token is generated each time the resource is evaluated, and it remains consistent for the duration of a Terraform operation. If a private key is not explicitly provided, the provider attempts to extract it from the service account key instead. Token generation logic prioritizes environment variables first, followed by provider configuration. Access tokens generated from service account keys expire after 60 minutes.
6+
Ephemeral resource that generates a short-lived STACKIT access token (JWT) using a service account key. A new token is generated each time the resource is evaluated, and it remains consistent for the duration of a Terraform operation. If a private key is not explicitly provided, the provider attempts to extract it from the service account key instead. Access tokens generated from service account keys expire after 60 minutes.
77
~> This ephemeral-resource is in beta and may be subject to breaking changes in the future. Use with caution. See our guide https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources for how to opt-in to use beta resources.
8+
~> Important: A service account key credentials must be configured either in the STACKIT provider configuration or via environment variables. If any other authentication method is configured, this ephemeral resource generation will fail with an error.
89
---
910

1011
# stackit_access_token (Ephemeral Resource)
1112

12-
Ephemeral resource that generates a short-lived STACKIT access token (JWT) using a service account key. A new token is generated each time the resource is evaluated, and it remains consistent for the duration of a Terraform operation. If a private key is not explicitly provided, the provider attempts to extract it from the service account key instead. Token generation logic prioritizes environment variables first, followed by provider configuration. Access tokens generated from service account keys expire after 60 minutes.
13+
Ephemeral resource that generates a short-lived STACKIT access token (JWT) using a service account key. A new token is generated each time the resource is evaluated, and it remains consistent for the duration of a Terraform operation. If a private key is not explicitly provided, the provider attempts to extract it from the service account key instead. Access tokens generated from service account keys expire after 60 minutes.
1314

1415
~> This ephemeral-resource is in beta and may be subject to breaking changes in the future. Use with caution. See our [guide](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources) for how to opt-in to use beta resources.
16+
~> Important: A service account key credentials must be configured either in the STACKIT provider configuration or via environment variables. If any other authentication method is configured, this ephemeral resource generation will fail with an error.
1517

1618
## Example Usage
1719

stackit/internal/services/access_token/ephemeral_resource.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (e *accessTokenEphemeralResource) Configure(ctx context.Context, req epheme
3636

3737
features.CheckBetaResourcesEnabled(
3838
ctx,
39-
&core.ProviderData{EnableBetaResources: ephemeralProviderData.EnableBetaResources},
39+
&ephemeralProviderData.ProviderData,
4040
&resp.Diagnostics,
4141
"stackit_access_token", "ephemeral_resource",
4242
)
@@ -62,12 +62,18 @@ func (e *accessTokenEphemeralResource) Metadata(_ context.Context, req ephemeral
6262
}
6363

6464
func (e *accessTokenEphemeralResource) Schema(_ context.Context, _ ephemeral.SchemaRequest, resp *ephemeral.SchemaResponse) {
65-
resp.Schema = schema.Schema{
66-
Description: features.AddBetaDescription("Ephemeral resource that generates a short-lived STACKIT access token (JWT) using a service account key. "+
65+
description := features.AddBetaDescription(
66+
"Ephemeral resource that generates a short-lived STACKIT access token (JWT) using a service account key. "+
6767
"A new token is generated each time the resource is evaluated, and it remains consistent for the duration of a Terraform operation. "+
6868
"If a private key is not explicitly provided, the provider attempts to extract it from the service account key instead. "+
69-
"Token generation logic prioritizes environment variables first, followed by provider configuration. "+
70-
"Access tokens generated from service account keys expire after 60 minutes.", core.EphemeralResource),
69+
"Access tokens generated from service account keys expire after 60 minutes.",
70+
core.EphemeralResource,
71+
)
72+
descriptionNote := "~> Important: A service account key credentials must be configured either in the STACKIT provider configuration or via environment variables. " +
73+
"If any other authentication method is configured, this ephemeral resource generation will fail with an error."
74+
75+
resp.Schema = schema.Schema{
76+
Description: fmt.Sprintf("%s\n%s", description, descriptionNote),
7177
Attributes: map[string]schema.Attribute{
7278
"access_token": schema.StringAttribute{
7379
Description: "JWT access token for STACKIT API authentication.",

0 commit comments

Comments
 (0)