terraform-provider-sentry icon indicating copy to clipboard operation
terraform-provider-sentry copied to clipboard

Feature request: data source support for sentry_project

Open snowhork opened this issue 3 years ago • 5 comments

Hi, can I use data source for sentry_project?

Like:

data "sentry_project" "main" {
  organization = data.sentry_organization.main.id
  team         = data.sentry_team.main.id
  slug         = "my-project"
}

Thanks!

snowhork avatar Oct 21 '22 01:10 snowhork

@snowhork Yes, it is possible. Are there any particular fields you'd like to get from a project?

jianyuan avatar Oct 31 '22 23:10 jianyuan

@jianyuan hmm... sentry_project seems not to be used for data_source. Is this document old?

https://registry.terraform.io/providers/jianyuan/sentry/latest/docs

image

snowhork avatar Nov 01 '22 00:11 snowhork

@snowhork I think @jianyuan was saying that it is actually possible to implement, not that is it already implemented. And for that, what properties of the project you would need exposed to the data source.

For me, maybe the same properties that standard resource has is a good starting point.

blackjid avatar Dec 26 '22 13:12 blackjid

Hiya @jianyuan this would be a very useful feature for our use of the provider as well. I've put together a minimal implementation of the sentry project data source and raised a PR against a forked repo for your review 🙂 https://github.com/jianyuan/terraform-provider-sentry/pull/301

christina-moore avatar May 30 '23 12:05 christina-moore

That would be a great feature. Here is an example from my organization:

  1. We have several environments for project (dev, stage, prod)
  2. We manage them independently with Terraform Workspaces
  3. We would like to use a single Sentry project for all environments.

With current state of this provider, this means that we would have to:

  1. Create a project in a single Terraform workspace
  2. Import the project/projects for every other workspace

This basically means that deploying new environments would require some tricky steps, making disaster recovery more difficult.

We could create new Sentry project for every environment, like stage-frontend, prod-frontend, but this goes against the official guidelines.

Our desired workflow looks like this:

  1. A user creates a project in Sentry;
  2. Terraform fetches it's DSN with data.sentry_project;
  3. Terraform puts the value into Hashicorp Vault;
  4. FluxCD fetches service's configuration from Vault, including project DSN, and deploys it into desire environment.

mommys-little-hacker avatar Jun 28 '23 16:06 mommys-little-hacker