Unexpected new value error when setting member_role_id in gitlab_group_share_group
Instance: gitlab.com Licence: Ultimate
When I try to add a group to a top-level group with a custom role, the terraform plan is successful, but the terraform apply ends with the error:
Terraform will perform the following actions:
# gitlab_group_share_group.top_level_organization_share_group_security is tainted, so must be replaced
-/+ resource "gitlab_group_share_group" "top_level_organization_share_group_security" {
~ id = "xxxxxxxx:yyyyyyyyy" -> (known after apply)
+ member_role_id = zzzzzzz
# (3 unchanged attributes hidden)
}
Plan: 1 to add, 0 to change, 1 to destroy.
gitlab_group_share_group.top_level_organization_share_group_security: Destroying... [id=xxxxxxxx:yyyyyyyyy]
gitlab_group_share_group.top_level_organization_share_group_security: Destruction complete after 1s
gitlab_group_share_group.top_level_organization_share_group_security: Creating...
Error: Provider produced inconsistent result after apply
When applying changes to
gitlab_group_share_group.top_level_organization_share_group_security,
provider "provider[\"registry.terraform.io/gitlabhq/gitlab\"]" produced an
unexpected new value: .member_role_id: was cty.NumberIntVal(2.005383e+06),
but now null.
This is a bug in the provider, which should be reported in the provider's own
issue tracker.
The tf code:
resource "gitlab_group_share_group" "top_level_organization_share_group_security" {
group_id = var.start_parent_id
share_group_id = local.gitlab_groups["organization/security"].id
group_access = "reporter"
member_role_id = zzzzzzz #this is the actual number
}
I am using the resource gitlab_group_share_group to assign other groups in standard roles (without setting member_role_id), without any issues. So if I remove the line with member_role_id from the example above, all members of the security group will have reporter access at the top-level organization group.
The custom role is already created. More details: #6600 (closed)