Skip to content

feat(iam): datasource to query service-accounts#1256

Open
h3adex wants to merge 1 commit intostackitcloud:mainfrom
h3adex:feat/add-service-accounts-datasource
Open

feat(iam): datasource to query service-accounts#1256
h3adex wants to merge 1 commit intostackitcloud:mainfrom
h3adex:feat/add-service-accounts-datasource

Conversation

@h3adex
Copy link
Contributor

@h3adex h3adex commented Feb 24, 2026

Description

This PR adds a datasource which is able to query service accounts based on email_regex and email_suffix. I also added the option to sort the result ascending, following the implementation of this datasource: https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/data-sources/image_v2#sort_ascending-1

While adding this datasource I've also adjusted our acceptance tests to the latest format.

Tested with the following code:

data "stackit_service_accounts" "sas" {
  project_id = "xxx"
}

data "stackit_service_accounts" "sas_suffix" {
  project_id   = "xxx"
  email_suffix = "@sa.stackit.cloud"
}

data "stackit_service_accounts" "sas_suffix_asc" {
  project_id     = "xxx"
  email_suffix   = "@sa.stackit.cloud"
  sort_ascending = true
}

data "stackit_service_accounts" "sas_regex" {
  project_id  = "xxx"
  email_regex = ".*@ske\\.sa\\.stackit\\.cloud$"
}

data "stackit_service_accounts" "ske_sa_suffix" {
  project_id   = "xxx"
  email_suffix = "@ske.sa.stackit.cloud"
}

Checklist

  • Issue was linked above
  • Code format was applied: make fmt
  • Examples were added / adjusted (see examples/ directory)
  • Docs are up-to-date: make generate-docs (will be checked by CI)
  • Unit tests got implemented or updated
  • Acceptance tests got implemented or updated (see e.g. here)
Screenshot 2026-02-24 at 11 03 29
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

@h3adex h3adex requested a review from a team as a code owner February 24, 2026 10:12
Signed-off-by: Mauritz Uphoff <mauritz.uphoff@stackit.cloud>
@h3adex h3adex force-pushed the feat/add-service-accounts-datasource branch from 39ed660 to fe005b0 Compare February 24, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant