Import gitlab_group_dependency_proxy results in recreating resource and cannot unmarshal array into Go value of type gitlab.Group
Bug Report
On our self hosted instance, we are trying to import the manually configured top level group dependency proxy for dockerhub. The plan output shows it will import, but then forces replacement due to group attribute changes. The group and ID showing the plan is the right top level group ID so not sure why it needs to replace the resource. Example plan output.
# module.unixteam.gitlab_group_dependency_proxy.dependency_proxy_group[0] must be replaced
# (imported from "24148")
# Warning: this will destroy the imported resource
-/+ resource "gitlab_group_dependency_proxy" "dependency_proxy_group" {
enabled = true
+ group = "24148" # forces replacement
~ id = "24148" -> (known after apply)
identity = "mydockerhubcred"
+ secret = (sensitive value)
}
Ran the terraform apply, shows import complete for this resource and then errors with this below.
module.unixteam.gitlab_group_dependency_proxy.dependency_proxy_group[0]: Importing... [id=24148]
module.unixteam.gitlab_group_dependency_proxy.dependency_proxy_group[0]: Import complete [id=24148]
module.unixteam.gitlab_group_dependency_proxy.dependency_proxy_group[0]: Destroying... [id=24148]
╷
│ Error: GitLab API error occurred
│
│ Unable to get group: json: cannot unmarshal array into Go value of type
│ gitlab.Group
Relevant Terraform Configuration
resource "gitlab_group_dependency_proxy" "dependency_proxy_group" {
count = var.group_name == "unixteam" ? 1 : 0
group = gitlab_group.top_level_group.id
identity = "mydockerhubcred"
secret = var.proxy_secret
enabled = true
}
Relevant Terraform Command
terraform apply
Relevant Log Output
Terraform will perform the following actions:
# module.unixteam.gitlab_group_dependency_proxy.dependency_proxy_group[0] must be replaced
-/+ resource "gitlab_group_dependency_proxy" "dependency_proxy_group" {
+ group = "24148" # forces replacement
~ id = "24148" -> (known after apply)
+ secret = (sensitive value)
# (2 unchanged attributes hidden)
}
Plan: 1 to add, 0 to change, 1 to destroy.
module.unixteam.gitlab_group_dependency_proxy.dependency_proxy_group[0]: Destroying... [id=24148]
╷
│ Error: GitLab API error occurred
│
│ Unable to get group: json: cannot unmarshal array into Go value of type gitlab.Group
╵
These are the debug logs of the `terraform` command output:
2025-07-28T13:17:30.477-0500 [ERROR] provider.terraform-provider-gitlab_v18.1.1: Response contains error diagnostic: diagnostic_detail="Unable to get group: json: cannot unmarshal array into Go value of type gitlab.Group" tf_proto_version=6.9 tf_provider_addr=registry.terraform.io/gitlabhq/gitlab tf_req_id=59f9fb73-cc5b-606a-164b-f6d428e5a742 tf_resource_type=gitlab_group_dependency_proxy @caller=github.com/hashicorp/terraform-plugin-go@v0.28.0/tfprotov6/internal/diag/diagnostics.go:58 @module=sdk.proto diagnostic_severity=ERROR diagnostic_summary="GitLab API error occurred" tf_rpc=ApplyResourceChange timestamp=2025-07-28T13:17:30.475-0500
╷
│ Error: GitLab API error occurred
│
│ Unable to get group: json: cannot unmarshal array into Go value of type gitlab.Group
╵
2025-07-28T13:17:30.898-0500 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2025-07-28T13:17:30.902-0500 [INFO] provider: plugin process exited: plugin=.terraform/providers/registry.terraform.io/gitlabhq/gitlab/18.1.1/darwin_arm64/terraform-provider-gitlab_v18.1.1 id=51597
2025-07-28T13:17:30.902-0500 [DEBUG] provider: plugin exited
Additional Details
- GitLab Terraform Provider Version:
18.1.1 - GitLab Instance Version:
v18.1.1-ee - Terraform Version:
1.12.2 - License Tier:
Ultimate