feat(incoming_email): add archestra_incoming_email org-singleton - #122
Open
priyanshu0x wants to merge 1 commit into
Open
priyanshu0x wants to merge 1 commit into
priyanshu0x wants to merge 1 commit into
Conversation
Org-singleton resource managing the platform's incoming-email webhook subscription (Microsoft Graph for the Outlook provider). Maps to POST /api/incoming-email/setup, GET /api/incoming-email/status, DELETE /api/incoming-email/subscription. Changing webhook_url is an in-place Update — the backend's setup endpoint explicitly "Cleans up ALL existing subscriptions before creating a new one", so RequiresReplace would needlessly thrash state for a no-op-at-the-backend operation. Computed `email_provider` (renamed from the wire's `provider` — Terraform reserves `provider` as a root attribute name and the schema fails to load otherwise), `subscription_id`, `expires_at`, `is_active` fill in from the status endpoint. Plain-HTTP URLs are rejected client-side (Microsoft Graph wouldn't accept them anyway). Un-excluded the `Incoming Email` OpenAPI tag in oapi-config.yaml and regenerated internal/client. Real happy-path testing requires a real Microsoft Graph tenant + publicly-reachable webhook URL the platform can subscribe to; the local stack ships without an email-provider credential, so the two shipped acceptance tests pin the validate-time HTTPS check and the backend's 400-on-no-provider-configured path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #121.
Org-singleton resource modeling the platform's incoming-email webhook subscription.
webhook_urlis the only Required attribute (HTTPS-validated up-front because Microsoft Graph rejects plain HTTP);subscription_id/email_provider/expires_at/is_activeare Computed and refreshed fromGET /api/incoming-email/status. Update = re-setup, since the backend deletes any existing subscription before creating a new one — bumpingwebhook_urlis a clean in-place change, no replace. Delete callsDELETE /api/incoming-email/subscription; 404 on Delete is treated as already-gone.One callout: the backend's
providerJSON field is renamed toemail_provideron the Terraform side becauseprovideris a reserved root-block name. The mapping is documented in the MarkdownDescription.Verification:
make lint test,make generate(no drift),TestAccIncomingEmailResource_NoProviderConfigured(pins the apply-time 400 when no org-level provider is set), andTestAccIncomingEmailResource_HttpsRequired(pins the regex validator) all green. Happy-path coverage requires a configured Outlook provider, which the local stack doesn't run; the two negative-path pins are the meaningful regression signals.