[BUG] The provider is not able to assign custom role to group access: gitlab_group_share_group
Bug Report
In the file to assign the custom role to the all teams
resource "gitlab_group_share_group" "access_of_group" {
for_each = var.enable_permissions ? local.all_teams : {}
group_id = module.some_group.id # object to which a subject has access
share_group_id = each.value.id # subject who has access to something
group_access = "developer"
member_role_id = var.enable_custom_roles ? gitlab_member_role.custom_role["custom_role"].iid : null
depends_on = [gitlab_member_role.custom_role]
}
Then in another file, the definition of the custom role:
locals {
custom_roles = {
"custom_role" = {
"name" : "Custom Role",
"description" : "Custom role providing engineers with vulnerability management and compliance dashboard access"
"base_access_level" : "DEVELOPER",
"enabled_permissions" : [
"ADMIN_VULNERABILITY",
"READ_COMPLIANCE_DASHBOARD",
]
}
}
}
resource "gitlab_member_role" "custom_role" {
for_each = var.enable_custom_roles ? local.custom_roles : {}
name = each.value.name
description = each.value.description
group_path = data.gitlab_group.main_group.full_path
base_access_level = each.value.base_access_level
enabled_permissions = each.value.enabled_permissions
}
Error:
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to
│ gitlab_group_share_group.engineer_access_to_code["team"], provider
│ "provider[\"registry.terraform.io/gitlabhq/gitlab\"]" produced an
│ unexpected new value: .member_role_id: was cty.NumberIntVal(2.00514e+06),
│ but now null.
│
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.
╵
Resources:
- https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/group_share_group
- https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/member_role
Relevant Terraform Command
terraform apply terraform.plan
Relevant Log Output
N/A
Additional Details
- GitLab Terraform Provider Version:
gitlabhq/gitlab v18.2.0 - License Tier:
Ultimate