Skip to content

feat: identify requests as the Terraform provider, not the Go SDK - #52

Merged
ChiragAgg5k merged 2 commits into
mainfrom
feat/sdk-identity-headers
Sep 28, 2026
Merged

ChiragAgg5k merged 2 commits into
mainfrom
feat/sdk-identity-headers

Conversation

@ChiragAgg5k

Copy link
Copy Markdown
Member

Description

The provider only overrode User-Agent. Every other SDK identity header still reported the Go SDK, so Appwrite attributed Terraform traffic to it. The server reads x-sdk-name to record which SDKs used an API key, and x-sdk-language to classify deployments.

Requests now send:

Header Before After
user-agent terraform-provider-appwrite/<ver> Terraform/<tf ver> terraform-provider-appwrite/<ver> AppwriteGoSDK/v7.5.0 (<os>; <arch>) + TF_APPEND_USER_AGENT
x-sdk-name Go Terraform
x-sdk-platform server server
x-sdk-language go terraform
x-sdk-version v7.5.0 provider version
  • WithUserAgent is replaced by common.WithIdentity(providerVersion, terraformVersion), fed req.TerraformVersion from Configure. The Terraform token is omitted when core doesn't report a version. The SDK token is read from the header the SDK already set, so it stays accurate across SDK bumps.
  • Removed the unused HTTPConfig.UserAgent field and a stale comment on AppendedUserAgent.

Server-side follow-up: API keys only record x-sdk-name values that match a server SDK in app/config/sdks.php, so Terraform won't appear in a key's sdks list until the server accepts it. Separately, app/controllers/shared/api.php compares the header case-sensitively against a lowercase list, so standard keys never record any SDK today.

Type of Change

  • Bug fix
  • New resource or data source
  • Enhancement to existing resource
  • Documentation
  • Other

Checklist

  • make lint passes
  • make test passes
  • make docs has been run and changes committed (no schema or docs changes)
  • Acceptance tests added/updated (for resource changes)
  • Examples added/updated (for new resources/data sources)

Appwrite attributes API key usage by x-sdk-name and classifies deployments by x-sdk-language, so reporting the Go SDK's values made provider traffic indistinguishable from direct SDK use.
@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Changes how the provider identifies itself to the API.

The PR appears safe to merge; no new actionable issue was established.

Summary

The PR identifies Appwrite requests as Terraform provider traffic in SDK headers and the User-Agent, then updates the tests to inspect headers received by a local HTTP server.

  • Both project and organization client options receive the Terraform and provider versions.
  • The identity tests now check outgoing requests rather than client configuration.

Reviews (2) · Last reviewed commit: "test: assert identity headers on an outb..."

Comment thread internal/common/identity_test.go Outdated
@ChiragAgg5k
ChiragAgg5k merged commit 334ec05 into main Sep 28, 2026
11 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the feat/sdk-identity-headers branch September 28, 2026 10:05
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.

2 participants