Skip to content

Commit 646c15d

Browse files
authored
feat/implement-sa-keys (#720)
* feat: implement service account key resource
1 parent 7d40a59 commit 646c15d

File tree

6 files changed

+627
-0
lines changed

6 files changed

+627
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "stackit_service_account_key Resource - stackit"
4+
subcategory: ""
5+
description: |-
6+
Service account key schema.
7+
~> 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.
8+
Example Usage
9+
Automatically rotate service account keys
10+
11+
resource "stackit_service_account" "sa" {
12+
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
13+
name = "sa01"
14+
}
15+
16+
resource "time_rotating" "rotate" {
17+
rotation_days = 80
18+
}
19+
20+
resource "stackit_service_account_key" "sa_key" {
21+
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
22+
service_account_email = stackit_service_account.sa.email
23+
ttl_days = 90
24+
25+
rotate_when_changed = {
26+
rotation = time_rotating.rotate.id
27+
}
28+
}
29+
---
30+
31+
# stackit_service_account_key (Resource)
32+
33+
Service account key schema.
34+
35+
~> 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.
36+
## Example Usage
37+
38+
39+
### Automatically rotate service account keys
40+
```terraform
41+
resource "stackit_service_account" "sa" {
42+
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
43+
name = "sa01"
44+
}
45+
46+
resource "time_rotating" "rotate" {
47+
rotation_days = 80
48+
}
49+
50+
resource "stackit_service_account_key" "sa_key" {
51+
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
52+
service_account_email = stackit_service_account.sa.email
53+
ttl_days = 90
54+
55+
rotate_when_changed = {
56+
rotation = time_rotating.rotate.id
57+
}
58+
}
59+
60+
```
61+
62+
63+
64+
<!-- schema generated by tfplugindocs -->
65+
## Schema
66+
67+
### Required
68+
69+
- `project_id` (String) The STACKIT project ID associated with the service account key.
70+
- `service_account_email` (String) The email address associated with the service account, used for account identification and communication.
71+
72+
### Optional
73+
74+
- `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.
75+
- `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.
76+
- `ttl_days` (Number) Specifies the key's validity duration in days. If left unspecified, the key is considered valid until it is deleted
77+
78+
### Read-Only
79+
80+
- `id` (String) Terraform's internal resource identifier. It is structured as "`project_id`,`service_account_email`,`key_id`".
81+
- `json` (String, Sensitive) The raw JSON representation of the service account key json, available for direct use.
82+
- `key_id` (String) The unique identifier for the key associated with the service account.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package key
2+
3+
const markdownDescription = `
4+
## Example Usage` + "\n" + `
5+
6+
### Automatically rotate service account keys` + "\n" +
7+
"```terraform" + `
8+
resource "stackit_service_account" "sa" {
9+
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
10+
name = "sa01"
11+
}
12+
13+
resource "time_rotating" "rotate" {
14+
rotation_days = 80
15+
}
16+
17+
resource "stackit_service_account_key" "sa_key" {
18+
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
19+
service_account_email = stackit_service_account.sa.email
20+
ttl_days = 90
21+
22+
rotate_when_changed = {
23+
rotation = time_rotating.rotate.id
24+
}
25+
}
26+
` + "\n```"

0 commit comments

Comments
 (0)