terraform-provider-gitlab icon indicating copy to clipboard operation
terraform-provider-gitlab copied to clipboard

Group creation results in "Root resource was present, but now absent"

Open dcoy opened this issue 2 years ago • 3 comments

Terraform Version

terraform version == 1.0.3 (also 1.0.0)

Affected Resource(s)

Please list the resources as a list, for example:

  • gitlab_group

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

terraform {
    required_providers {
        gitlab = {
            source = "gitlabhq/gitlab"
            version = "3.7.0"
        }
    }
}

provider "gitlab" {
    base_url = "https://gitlab.domain/"
    token = "tokenGoesHere"
    insecure = true
}


variable "gitlab_token" {
    default = []
}

resource "gitlab_group" "tfgroup" {
    name = "tfgroup"
    path = "tfgroup"
    description = "An example group"
}

Debug Output

TF Debug Log

Panic Output

N/A

Expected Behavior

GitLab Terraform provider creates the group, then successfully reads the group to confirm the state change.

Actual Behavior

The GitLab Terraform provider will create the group, but then will immediately attempt to read the state of the created group. The group itself is created through GitLab, however, GitLab cannot create the group quickly enough for the provider to read the state of the group from the API. Eventually, this will succeed, but on first pass the group creation will fail.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply to create the group

Important Factoids

GitLab EE v14.0.0

References

N/A

dcoy avatar Aug 10 '21 21:08 dcoy

+1 Using self hosted gitlab instance, same problem with creating groups.

jttrail0 avatar Aug 16 '21 03:08 jttrail0

We could probably easily fix this if some waiting conditions / retry logic.

However, I think it's best to get some details on how the Group API is supposed to work. I've created https://gitlab.com/gitlab-org/gitlab/-/issues/352299 for that.

Let's see ...

timofurrer avatar Feb 08 '22 18:02 timofurrer

I've created another upstream issue to tackle these kind of issues: https://gitlab.com/gitlab-org/gitlab/-/issues/365055

timofurrer avatar Jun 10 '22 14:06 timofurrer