Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions docs/resources/service_account_key.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_service_account_key Resource - stackit"
subcategory: ""
description: |-
Service account access key schema.
~> This 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.
Example Usage
Automatically rotate service account keys
resource "stackit_service_account" "sa" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "sa01"
}
resource "time_rotating" "rotate" {
rotation_days = 80
}
resource "stackit_service_account_key" "sa_key" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
service_account_email = stackit_service_account.sa.email
ttl_days = 90
rotate_when_changed = {
rotation = time_rotating.rotate.id
}
}
---

# stackit_service_account_key (Resource)

Service account access key schema.

~> This 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.
## Example Usage


### Automatically rotate service account keys
```terraform
resource "stackit_service_account" "sa" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "sa01"
}
resource "time_rotating" "rotate" {
rotation_days = 80
}
resource "stackit_service_account_key" "sa_key" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
service_account_email = stackit_service_account.sa.email
ttl_days = 90
rotate_when_changed = {
rotation = time_rotating.rotate.id
}
}
```



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `project_id` (String) The STACKIT project ID associated with the service account key.
- `service_account_email` (String) The email address associated with the service account, used for account identification and communication.

### Optional

- `public_key` (String) Specifies the public_key (RSA2048 key-pair). If not provided, a certificate from STACKIT will be used to generate a private_key.
- `rotate_when_changed` (Map of String) A map of arbitrary key/value pairs designed to force key recreation when they change, facilitating key rotation based on external factors such as a changing timestamp. Modifying this map triggers the creation of a new resource.
- `ttl_days` (Number) Specifies the key's validity duration in days. If left unspecified, the key is considered valid until it is deleted

### Read-Only

- `id` (String) Terraform's internal resource identifier. It is structured as "`project_id`,`service_account_email`,`key_id`".
- `json` (String, Sensitive) The raw JSON representation of the service account key json, available for direct use.
- `key_id` (String) The unique identifier for the key associated with the service account.
26 changes: 26 additions & 0 deletions stackit/internal/services/serviceaccount/key/const.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package key

const markdownDescription = `
## Example Usage` + "\n" + `
### Automatically rotate service account keys` + "\n" +
"```terraform" + `
resource "stackit_service_account" "sa" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "sa01"
}
resource "time_rotating" "rotate" {
rotation_days = 80
}
resource "stackit_service_account_key" "sa_key" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
service_account_email = stackit_service_account.sa.email
ttl_days = 90
rotate_when_changed = {
rotation = time_rotating.rotate.id
}
}
` + "\n```"
Loading