Support for auditor indicator in gitlab_user resource
<!--IssueSummary start-->
<details>
<summary>
Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards.
</summary>
- [Label this issue](https://contributors.gitlab.com/manage-issue?action=label&projectId=40916776&issueIid=6843)
- [Collaborate/take over this issue](https://contributors.gitlab.com/manage-issue?action=work&projectId=40916776&issueIid=6843)
</details>
<!--IssueSummary end-->
## New Attribute in Resource
There are four types of users in GitLab
- regular
- admin
- auditor
- external
`gitlab_user` resource already has optional flags to specify user type as `regular`, `admin` or `external` (`is_admin`, `is_external`). Similar flag for auditor is missing. I'm looking for something that I could use like this:
```hcl
resource "gitlab_user" "auditor" {
name = "Example Auditor"
username = "auditor"
email = "auditor@user.create"
### NEW ATTRIBUTE
is_auditor = true # defaults to false
}
```
It would be even better if current flags (`is_admin`, `is_external`) are replaced by enum.
```hcl
resource "gitlab_user" "auditor" {
name = "Example Auditor"
username = "auditor"
email = "auditor@user.create"
### NEW ATTRIBUTE
type = "auditor" # possible values: "regular", "admin", "auditor", "external"; defaults to "regular"
}
```
## Related GitLab APIs
API documentation: <https://docs.gitlab.com/api/users/#create-a-user>
## Additional Details
- [x] [GitLab REST API resources](https://docs.gitlab.com/api/api_resources/) available (*read* for data sources, *CRUD* for resources)
- [x] [client-go](https://gitlab.com/gitlab-org/api/client-go) supports the related GitLab API already
- [ ] I'd like to contribute it myself
---
## Implementation Plan
### Why
GitLab's user management API supports an `auditor` boolean attribute (introduced in GitLab 15.3, Premium/Ultimate only) to designate users as auditors. The Terraform provider currently lacks this capability, forcing users to manage auditor status outside of Terraform or through direct API calls. Adding this attribute brings the provider into full alignment with the GitLab API and enables complete user lifecycle management in Terraform.
### What
Add a new optional `is_auditor` boolean attribute to the `gitlab_user` resource that:
- Defaults to `false`
- Maps directly to the GitLab API's `auditor` parameter
- Works with both create and update operations
- Includes proper validation and documentation
- Is tested with acceptance tests covering create, update, and import scenarios
**Note:** This is a simple boolean flag addition (not an enum refactor). The existing `is_admin` and `is_external` flags remain unchanged to avoid breaking changes.
### How
#### Implementation Steps
1. **Update Resource Schema** (`internal/provider/resource_gitlab_user.go`)
- Add `is_auditor` attribute to the schema as an optional boolean with default `false`
- Add description noting it's Premium/Ultimate only and requires GitLab 15.3+
- Ensure proper ordering with other user type flags
2. **Update API Mapping**
- In the Create operation: map `is_auditor` → `auditor` when building the API request
- In the Read operation: map API `auditor` response → `is_auditor` in state
- In the Update operation: include `auditor` in the update payload when changed
- In the Delete operation: no changes needed
3. **Add Acceptance Tests** (`internal/provider/resource_gitlab_user_test.go`)
- **Create test**: Verify user can be created with `is_auditor = true`
- **Update test**: Verify `is_auditor` can be toggled between `true` and `false`
- **Import test**: Verify imported user state includes correct `is_auditor` value
- Use inline test configurations per CONTRIBUTING.md guidelines
4. **Run Test Suite**
- Execute `make reviewable` to format, generate docs, and run unit tests
- Run acceptance tests: `make testacc RUN=TestAccGitlabUser`
- Verify no regressions in existing user tests
5. **Documentation**
- Auto-generated via `make generate` (do not edit `/docs` manually)
- Ensure example in `/examples` shows `is_auditor` usage
#### Key Considerations
- **API Alignment**: The attribute name in Terraform is `is_auditor` (consistent with `is_admin`, `is_external`), mapping to GitLab API's `auditor`
- **Tier Requirement**: Premium/Ultimate only; document this clearly in schema description
- **GitLab Version**: Requires GitLab 15.3+; consider adding version check if provider enforces minimum versions
- **No Breaking Changes**: This is purely additive; existing configurations remain valid
#### Testing Checklist
- [ ] Unit tests pass: `make test`
- [ ] Acceptance tests pass: `make testacc RUN=TestAccGitlabUser`
- [ ] Code formatted: `make fmt`
- [ ] Documentation generated: `make generate`
- [ ] Full `make reviewable` passes
- [ ] No regressions in related user resource tests
issue