Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 404 when deleting a user which does not exist #167

Closed
3 tasks done
Danielku15 opened this issue Oct 31, 2024 · 1 comment
Closed
3 tasks done

Error 404 when deleting a user which does not exist #167

Danielku15 opened this issue Oct 31, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Danielku15
Copy link
Contributor

Describe the bug
If you have a project_user in your TF state which does not exist in Artifactory anymore, the apply fails because of a 404 error. The exact error is:

Error:
404 DELETE https://host/access/api/v1/projects/hcpo/users/myuser
{
"errors" : [ {
"code" : "NOT_FOUND",
"message" : "Could not find user: `myuser`"
} ]
}

Requirements for and issue

  • A fully functioning terraform snippet that can be copy&pasted (no outside files or ENV vars unless that's part of the issue)
resource "project" "myproject" {
  key = "myproj"
  display_name = "My Project"
  description  = "My Project"
  admin_privileges {
    manage_members   = true
    manage_resources = true
    index_resources  = true
  }
  max_storage_in_gibibytes   = 10
  block_deployments_on_limit = false
  email_notification         = true
}

resource "project_user" "myuser" {
  project_key = "myproj"
  name        = "myuser"
  roles       = ["Viewer"]
  ignore_missing_user = true
}

  • Your version of artifactory (you can curl it at $host/artifactory/api/system/version

7.99.2

  • Your version of terraform

1.5.6

Expected behavior
The delete operation should be considered successful in this case. If the user doen't exist (anymore), the operation can be considered a success.

Additional context
In our case we created the project_user really with ignore_missing_user = true and the user never existed, and now we want to remove him fully. But I assume this problem can also happen if somebody manually removes the user in Artifactory and then trying to update terraform afterwards.

We have seen another issue that the "refreshing state" might have some problems aorund project_user inconsistencies. I might file anoter bug report for that but need to narrow things down first. I thoughts its worth mentioning.

@Danielku15 Danielku15 added the bug Something isn't working label Oct 31, 2024
@Danielku15
Copy link
Contributor Author

seems we were on a very old TF provider version. On code I saw that the scenario should be covered. I updated the provider on our side. If the problem reoccures I might reopen this issue.

Sorry for the noise.

@Danielku15 Danielku15 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants