terraform-provider-stackitp.../docs/resources/service_account_key.md
2025-05-07 11:34:30 +02:00

2.5 KiB

page_title subcategory description
stackit_service_account_key Resource - stackit Service account key schema. 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 key schema.

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
  }	
}

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.