Skip to content

gitlab_user resource causes destroy/add of imported resource, because of the `skip_confirmation` attribute

Created by: olhado

GitLab Provider version

3.14.0

GitLab version

Gitlab EE 4.5

Terraform version

Terraform v1.0.11

Relevant Terraform Configuration

resource "gitlab_user" "example_user" {
  name             = "Example User"
  username         = "exampleuser"
  email            = "user@example.com"
  is_admin         = true
  projects_limit   = 0
  can_create_group = false
  is_external      = false
  note             = "Ipsum Lorem."
}

Relevant log output

# gitlab_user.example_user must be replaced
-/+ resource "gitlab_user" "example_user" {
      ~ id                = "4" -> (known after apply)
        name              = "Example User"
      ~ namespace_id      = 0 -> (known after apply)
      + skip_confirmation = true # forces replacement
        # (8 unchanged attributes hidden)
    }

Description

I imported the user defined above (details differ due to sensitive information in actual user) using terraform import gitlab.example_user 4. I then run terraform plan and get the log output, which wants to recreate the user due to the skip_confirmation field. Setting this field to true doesn't change the behavior. I assume it is related to #491 ?

The skip_confirmation field shouldn't force a recreate.

(As an aside, it appears the import is incorrect. The namespace_id in the plan output says 0, and I confirmed the state file had the same data. However, the namespace_id for the existing user was actually a different number.)

Edited by Timo Furrer