Skip to content

Artifactory provider fails to create scoped token with "Invalid formatted name" error #1246

Description

@mpomara-newwork

Describe the bug

When attempting to create an Artifactory scoped token using the Terraform provider, a "BAD_REQUEST" error occurs with the message "Invalid formatted name: github-actions-oidc". The error message suggests that there's an issue with the formatting of the name parameter.

Requirements for an 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.

    resource "artifactory_scoped_token" "github-dependabot-second" {
        username    = "github-dependabot"
        description = "github-dependabot-second"
    
        scopes    = ["applied-permissions/groups:readers"]
        audiences = ["*@*"] ### * would be all audiences
    
        expires_in = 604800 ### 7 days in seconds
    
        include_reference_token = true
    }
  • Your version of artifactory: Artifactory/7.111.2

  • Your version of terraform: 1.10.3

  • Your version of terraform provider: jfrog/terraform-provider-artifactory/12.9.2

  • Your product license: Enterprise X

  • Is your Artifactory Cloud or Self-Hosted: Cloud

  • JFrog support reference (if already raised with support team): 350759

Expected behavior

Expect the scoped token to be created successfully without any error when using the Terraform provider.

Additional context

The error log details that the request to create the token returns a 400 Bad Request status with the message "Invalid formatted name: github-actions-oidc". I'm not sure where this error is coming from, because in the request I'm not passing anything that has anything to do with the name github-actions-oidc. The only place where I use this name is in the name of a OIDC integration that I have setup. It's called github-actions-oidc.

Here's the logs that I got by setting verbose output:

2025-04-23T09:49:13.729Z [WARN]  unexpected data:
  registry.terraform.io/jfrog/artifactory:stderr=
  | 2025/04/23 09:49:13.729358 DEBUG RESTY 
  | ==============================================================================
  | ~~~ REQUEST ~~~
  | POST  /artifactory/api/system/usage  HTTP/1.1
  | HOST   : <REDACTED>
  | HEADERS:
  | \tAccept: */*
  | \tAuthorization: <REDACTED>
  | \tContent-Type: application/json
  | \tUser-Agent: jfrog/terraform-provider-artifactory/12.9.2
  | BODY   :
  | {
  |    "productId": "terraform-provider-artifactory/12.9.2",
  |    "features": [
  |       {
  |          "featureId": "Partner/ACC-007450"
  |       },
  |       {
  |          "featureId": "Resource/artifactory_scoped_token/CREATE"
  |       }
  |    ]
  | }
  | 
  | ------------------------------------------------------------------------------
  | ~~~ RESPONSE ~~~
  | STATUS       : 200 
  | PROTO        : HTTP/1.1
  | RECEIVED AT  : 2025-04-23T09:49:13.729336882Z
  | TIME DURATION: 13.085587ms
  | HEADERS      :
  | \tConnection: keep-alive
  | \tContent-Length: 0
  | \tDate: Wed, 23 Apr 2025 09:49:13 GMT
  | \tX-Artifactory-Id: <REDACTED>
  | \tX-Artifactory-Node-Id: <REDACTED>
  | \tX-Jfrog-Version:
  
2025-04-23T09:49:13.729Z [WARN]  unexpected data:
  registry.terraform.io/jfrog/artifactory:stderr=
  | Artifactory/7.111.2 711102900
  | \tX-Request-Id: <REDACTED>
  | BODY         :
  | ***** NO CONTENT *****
  | ==============================================================================
  
2025-04-23T09:49:13.732Z [INFO]  provider.terraform-provider-github_v6.6.0: configuring server automatic mTLS: timestamp=2025-04-23T09:49:13.732Z
2025-04-23T09:49:13.744Z [WARN]  unexpected data:
  registry.terraform.io/jfrog/artifactory:stderr=
  | 2025/04/23 09:49:13.744024 DEBUG RESTY 
  | ==============================================================================
  | ~~~ REQUEST ~~~
  | POST  /access/api/v1/tokens  HTTP/1.1
  | HOST   : <REDACTED>
  | HEADERS:
  | \tAccept: */*
  | \tAuthorization: <REDACTED>
  | \tContent-Type: application/json
  | \tUser-Agent: jfrog/terraform-provider-artifactory/12.9.2
  | BODY   :
  | {
  |    "grant_type": "client_credentials",
  |    "username": "github-dependabot",
  |    "project_key": "",
  |    "scope": "applied-permissions/groups:readers",
  |    "expires_in": 604800,
  |    "refreshable": false,
  |    "description": "github-dependabot-second",
  |    "audience": "*@*",
  |    "include_reference_token": true
  | }
  | 
  | ------------------------------------------------------------------------------
  | ~~~ RESPONSE ~~~
  | STATUS       : 400 Bad Request
  | PROTO        : HTTP/1.1
  | RECEIVED AT  : 2025-04-23T09:49:13.743985588Z
  | TIME DURATION: 27.801409ms
  | HEADERS      :
  | \tCache-Control: no-cache, no-store, max-age=0, must-revalidate
  | \tConnection: keep-alive
  | \tContent-Length: 116
  | \tContent-Type: application
  
Error: -23T09:49:13.744Z [ERROR] provider.terraform-provider-artifactory_v12.9.2: Response contains error diagnostic: diagnostic_summary="Unable to Create Resource" tf_provider_addr=jfrog/artifactory tf_req_id=<REDACTED> tf_resource_type=artifactory_scoped_token
  diagnostic_detail=
  | An unexpected error occurred while creating the resource update request. Please report this issue to the provider developers.
  | 
  | Error: {
  |   "errors" : [ {
  |     "code" : "BAD_REQUEST",
  |     "message" : "Invalid formatted name: github-actions-oidc"
  |   } ]
  | }
   diagnostic_severity=ERROR tf_proto_version=6.8 tf_rpc=ApplyResourceChange @caller=<REDACTED> @module=sdk.proto timestamp=2025-04-23T09:49:13.744Z
2025-04-23T09:49:13.744Z [WARN]  unexpected data:
  registry.terraform.io/jfrog/artifactory:stderr=
  | /json;charset=UTF-8
  | \tDate: Wed, 23 Apr 2025 09:49:13 GMT
  | \tExpires: 0
  | \tPragma: no-cache
  | \tStrict-Transport-Security: max-age=31536000; includeSubDomains
  | \tX-Content-Type-Options: nosniff
  | \tX-Frame-Options: DENY
  | \tX-Jfrog-Version: JFrog Access/7.140.2
  | \tX-Xss-Protection: 1; mode=block
  | BODY         :
  | {
  |    "errors": [
  |       {
  |          "code": "BAD_REQUEST",
  |          "message": "Invalid formatted name: github-actions-oidc"
  |       }
  |    ]
  | }
  | ==============================================================================

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriaged

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions