Add read-only data sources for all three Terraform resources

Mechanical, low-risk follow-up -- no new architectural question, no new
external service, no new write path. Each of sentry_dashboard,
sentry_alert_rule, and sentry_notification_target gets a matching data
source: a single Required id attribute in, every other attribute
Computed out, backed by the exact same getDashboard/getRule/
getNotificationTarget client methods and dashboardModelFromAPI/
alertRuleModelFromAPI/notificationTargetModelFromAPI conversion
functions the resources already use and already have tests for -- these
data sources add no new client code at all, just a thin
datasource.DataSource wrapper reusing what Create/Read/Update/Delete
already exercise.

sentry_notification_target's data source carries the same secret
caveat its resource does (Sensitive, but alerting's GET /targets/{id}
returns it unredacted, so it's a real plaintext value in Terraform
state) -- named again here rather than assumed obvious from the
resource's own docs.

Verified: provider_test.go's new schema-validation tests confirm each
data source's id is Required and everything else Computed, no
Terraform binary needed. Three new real acceptance tests
(TestAccDashboardDataSource_basic and its two siblings) each create a
resource then look it up via the matching data source, using
resource.TestCheckResourceAttrPair to prove the data source's Read
actually agrees with what the resource wrote -- not just that both
compile. Skip-gated by TF_ACC same as the existing six acceptance
tests, and needs the same live api/alerting services this environment
has no Docker access to bring up, so not run here -- same disclosed gap
as everything else Docker-gated in this repo.
This commit is contained in:
2026-08-15 10:28:08 -07:00
parent 30ae84cd04
commit eb38611aa8
13 changed files with 556 additions and 30 deletions
+7 -6
View File
@@ -23,12 +23,13 @@ described there without flagging it to me first.
as of this note -- three resources (`sentry_dashboard`, full CRUD;
`sentry_alert_rule` and `sentry_notification_target`, both create/
destroy only -- `alerting` has no `PUT /rules/{id}` or
`PUT /targets/{id}` to update against), built on HashiCorp's
`terraform-plugin-framework`, reusing the exact same REST contracts
`sentryctl dashboards apply`/web's dashboard export and
`sentryctl alerts apply` already use. Tenant/RBAC resources are real,
disclosed future work -- see `/terraform/README.md` for the full
accounting of what is and isn't built, and the same
`PUT /targets/{id}` to update against), each paired with a read-only
data source, built on HashiCorp's `terraform-plugin-framework`,
reusing the exact same REST contracts `sentryctl dashboards apply`/
web's dashboard export and `sentryctl alerts apply` already use.
Tenant/RBAC resources are real, disclosed future work -- see
`/terraform/README.md` for the full accounting of what is and isn't
built, and the same
"written but not run against a live stack" verification caveat as
everything else Docker-gated in this repo.