Read project_id back for project runners in gitlab_user_runner

What does this MR do and why?

Importing a gitlab_user_runner with runner_type = "project_type" left project_id unset in state, because modelToStateModel only mapped the group ID back from the API response. project_id has RequiresReplace, so the next terraform plan proposed destroying and recreating the runner — the same defect #6745 (closed) fixed for group_id.

This MR maps the first entry of the runner's projects from the API response into project_id, mirroring the group handling, and warns when the response has none. The project runner acceptance test now verifies project_id on import instead of ignoring it.

Resolves #6865 (closed)

How to test

  1. Create a project runner with the resource, then terraform state rm it and terraform import gitlab_user_runner.this <runner id>.
  2. terraform plan — on main it proposes replacement (project_id: null -> <id>); with this MR the plan is empty.
  3. TF_ACC=1 go test ./internal/provider -run TestAcc_GitlabUserRunner_basicProjectRunner.
Edited by Jeston Singh

Merge request reports

Loading
Loading