Groups with spaces cannot be used to configure group scoped tokens
bertramn opened this issue · 1 comments
bertramn commented
When creating a group with a space in the name, I am unable to use that group to create a scoped token with permissions of that group.
Requirements for and issue
- A description of the bug
- A fully functioning terraform snippet that can be copy&pasted (no outside files or ENV vars unless that's part of the issue). If this is not supplied, this issue will likely be closed without any effort expended.
- Your version of artifactory
- Your version of terraform
- Your version of terraform provider
artifactory version
7.81.1
terraform version
Terraform v1.7.3
on darwin_arm64
+ provider registry.terraform.io/gitlabhq/gitlab v16.9.1
+ provider registry.terraform.io/jfrog/artifactory v10.2.0
+ provider registry.terraform.io/jfrog/project v1.4.0
Example 1 - using the group name as is
resource "artifactory_user" "devops_bot" {
name = "devops-bot"
email = "devops@localhost"
}
resource "artifactory_group" "release_managers" {
name = "Release Managers"
}
resource "artifactory_scoped_token" "gitlab_release_bot" {
username = artifactory_user.devops_bot.name
scopes = [
"applied-permissions/groups:${artifactory_group.release_managers.name}"
]
}
Result:
│ Error: Unable to Create Resource
│
│ with artifactory_scoped_token.gitlab_release_bot,
│ on af_bots.tf line 26, in resource "artifactory_scoped_token" "gitlab_release_bot":
│ 26: resource "artifactory_scoped_token" "gitlab_release_bot" {
│
│ An unexpected error occurred while creating the resource update request. Please report this issue to the provider developers.
│
│ Error:
│ 400 POST https://virginaustralia.jfrog.io/access/api/v1/tokens
│ {
│ "errors" : [ {
│ "code" : "BAD_REQUEST",
│ "message" : "Illegal permission scope token: Managers; expected format: <resourceType>:<target>[/<sub-resource>]:<actions>"
│ } ]
│ }
╵
Example 2 - quoting the group name in string
resource "artifactory_user" "devops_bot" {
name = "devops-bot"
email = "devops@localhost"
}
resource "artifactory_group" "release_managers" {
name = "Release Managers"
}
resource "artifactory_scoped_token" "gitlab_release_bot" {
username = artifactory_user.devops_bot.name
scopes = [
"applied-permissions/groups:\"${artifactory_group.release_managers.name}\""
]
}
Result:
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to artifactory_scoped_token.gitlab_release_bot, provider "provider[\"registry.terraform.io/jfrog/artifactory\"]" produced an unexpected new value:
│ .scopes: planned set element cty.StringVal("applied-permissions/groups:\"Release Managers\",") does not correlate with any element in actual.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to artifactory_scoped_token.gitlab_release_bot, provider "provider[\"registry.terraform.io/jfrog/artifactory\"]" produced an unexpected new value:
│ .scopes: length changed from 1 to 2.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
Expected behavior
Expecting to be able to use groups with spaces in name using the terraform provider.