Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filtering options for data source google_service_accounts #20928

Open
bestefreund opened this issue Jan 15, 2025 · 0 comments
Open

Filtering options for data source google_service_accounts #20928

bestefreund opened this issue Jan 15, 2025 · 0 comments
Labels

Comments

@bestefreund
Copy link

bestefreund commented Jan 15, 2025

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Description

Currently, if the data source google_service_accounts is used, all service accounts from a project are part of the query result and all this information will be persisted into the state.

With options for filtering this can be prevented.

Something like a prefix-option on the account_id and a regex-option on the email which can also be used in combination.

As the used API doesn't provide filtering options, this could be added into the data source's implementation.

This depends on fix of #20920 where pagination support for this data source will be added.

New or Affected Resource(s)

  • google_service_accounts

Potential Terraform Configuration

resource "google_service_account" "sa_one" {
  account_id   = "sa-one"
  description  = "sa-one"
  display_name = "sa-one"
}

data "google_service_accounts" "with_prefix" {
  prefix  = "sa-"
}

data "google_service_accounts" "with_regex" {
  regex   = ".*${google_service_account.sa_one.account_id}.*@.*\\.gserviceaccount\\.com"
}

data "google_service_accounts" "with_prefix_and_regex" {
  prefix  = google_service_account.sa_one.account_id
  regex   = ".*${google_service_account.sa_one.account_id}.*@.*\\.gserviceaccount\\.com"
}

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant