Add gitlab_user_saved_reply, gitlab_group_saved_reply, gitlab_project_saved_reply

resolves: #6815 (closed)

GitLab exposes comment templates ("saved replies") at three scopes — user, group, and project — entirely via GraphQL with no REST or client-go coverage. Add three new Plugin Framework resources that hand-roll the create / read / update / destroy mutations against /api/graphql:

  • gitlab_user_saved_reply — personal templates on the authenticated user. Available on the Free tier.
  • gitlab_group_saved_reply — templates shared across a group. Requires Premium or Ultimate.
  • gitlab_project_saved_reply — templates shared across a project. Requires Premium or Ultimate.

Each resource exposes name, content, the parent scope (group / project) where applicable, and the GraphQL Global ID as its id attribute. Updates round-trip in-place via the upstream *SavedReply Update mutations. Destroy uses the matching *SavedReplyDestroy. The group/project resources resolve the parent identifier (ID or full path) via REST GetGroup / GetProject before constructing the GraphQL Global ID; this matches the convention used by other group/project resources in the provider.

Shared concerns (the SavedReply projection, the mutation payload shape, the standard GraphQL top-level error envelope, and a small error-flattening helper) live in resource_gitlab_saved_reply_common.go so the three resources stay small and identical in structure.

Acceptance tests for the group and project resources are gated by a new testutil.SkipIfNotPremiumOrUltimate helper (and a companion SkipIfNotUltimate) backed by /api/v4/license. The existing SkipIfCE helper only distinguishes EE binaries from CE binaries — it misses the common case of an EE binary running without a Premium/Ultimate license, where saved-reply mutations return "you don't have permission" at runtime. The new helper checks the license plan and skips cleanly instead of failing red.

References:

Changelog: ADDED Subsystem: resource/gitlab_user_saved_reply, resource/gitlab_group_saved_reply, resource/gitlab_project_saved_reply

Edited by Jimmy Spagnola

Merge request reports

Loading