1. Packages
  2. Artifactory Provider
  3. API Docs
  4. ApiKey
artifactory v8.8.0 published on Friday, Mar 7, 2025 by Pulumi

artifactory.ApiKey

Explore with Pulumi AI

Provides an Artifactory API key resource. This can be used to create and manage Artifactory API keys.

Note: API keys will be stored in the raw state as plain-text. Read more about sensitive data in state.

!> As notified in Artifactory 7.47.10, support for API Key is slated to be removed in a future release. To ease customer migration to reference tokens, which replaces API key, we are disabling the ability to create new API keys at the end of Q3 2024. The ability to use API keys will be removed at the end of Q4 2024. For more information, see JFrog API Key Deprecation Process.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";

// Create a new Artifactory API key for the configured user
const ci = new artifactory.ApiKey("ci", {});
Copy
import pulumi
import pulumi_artifactory as artifactory

# Create a new Artifactory API key for the configured user
ci = artifactory.ApiKey("ci")
Copy
package main

import (
	"github.com/pulumi/pulumi-artifactory/sdk/v8/go/artifactory"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// Create a new Artifactory API key for the configured user
		_, err := artifactory.NewApiKey(ctx, "ci", nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Artifactory = Pulumi.Artifactory;

return await Deployment.RunAsync(() => 
{
    // Create a new Artifactory API key for the configured user
    var ci = new Artifactory.ApiKey("ci");

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.artifactory.ApiKey;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        // Create a new Artifactory API key for the configured user
        var ci = new ApiKey("ci");

    }
}
Copy
resources:
  # Create a new Artifactory API key for the configured user
  ci:
    type: artifactory:ApiKey
Copy

Create ApiKey Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ApiKey(name: string, args?: ApiKeyArgs, opts?: CustomResourceOptions);
@overload
def ApiKey(resource_name: str,
           args: Optional[ApiKeyArgs] = None,
           opts: Optional[ResourceOptions] = None)

@overload
def ApiKey(resource_name: str,
           opts: Optional[ResourceOptions] = None)
func NewApiKey(ctx *Context, name string, args *ApiKeyArgs, opts ...ResourceOption) (*ApiKey, error)
public ApiKey(string name, ApiKeyArgs? args = null, CustomResourceOptions? opts = null)
public ApiKey(String name, ApiKeyArgs args)
public ApiKey(String name, ApiKeyArgs args, CustomResourceOptions options)
type: artifactory:ApiKey
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args ApiKeyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args ApiKeyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args ApiKeyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args ApiKeyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ApiKeyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var apiKeyResource = new Artifactory.ApiKey("apiKeyResource");
Copy
example, err := artifactory.NewApiKey(ctx, "apiKeyResource", nil)
Copy
var apiKeyResource = new ApiKey("apiKeyResource");
Copy
api_key_resource = artifactory.ApiKey("apiKeyResource")
Copy
const apiKeyResource = new artifactory.ApiKey("apiKeyResource", {});
Copy
type: artifactory:ApiKey
properties: {}
Copy

ApiKey Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ApiKey resource accepts the following input properties:

Outputs

All input properties are implicitly available as output properties. Additionally, the ApiKey resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Key string
The API key. Deprecated.

Deprecated: Deprecated in favor of "artifactory.ScopedToken".

ApiKey string
The API key. Deprecated.

Deprecated: Deprecated in favor of "artifactory.ScopedToken".

Id string
The provider-assigned unique ID for this managed resource.
apiKey String
The API key. Deprecated.

Deprecated: Deprecated in favor of "artifactory.ScopedToken".

id String
The provider-assigned unique ID for this managed resource.
apiKey string
The API key. Deprecated.

Deprecated: Deprecated in favor of "artifactory.ScopedToken".

id string
The provider-assigned unique ID for this managed resource.
api_key str
The API key. Deprecated.

Deprecated: Deprecated in favor of "artifactory.ScopedToken".

id str
The provider-assigned unique ID for this managed resource.
apiKey String
The API key. Deprecated.

Deprecated: Deprecated in favor of "artifactory.ScopedToken".

id String
The provider-assigned unique ID for this managed resource.

Look up Existing ApiKey Resource

Get an existing ApiKey resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ApiKeyState, opts?: CustomResourceOptions): ApiKey
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        api_key: Optional[str] = None) -> ApiKey
func GetApiKey(ctx *Context, name string, id IDInput, state *ApiKeyState, opts ...ResourceOption) (*ApiKey, error)
public static ApiKey Get(string name, Input<string> id, ApiKeyState? state, CustomResourceOptions? opts = null)
public static ApiKey get(String name, Output<String> id, ApiKeyState state, CustomResourceOptions options)
resources:  _:    type: artifactory:ApiKey    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Key string
The API key. Deprecated.

Deprecated: Deprecated in favor of "artifactory.ScopedToken".

ApiKey string
The API key. Deprecated.

Deprecated: Deprecated in favor of "artifactory.ScopedToken".

apiKey String
The API key. Deprecated.

Deprecated: Deprecated in favor of "artifactory.ScopedToken".

apiKey string
The API key. Deprecated.

Deprecated: Deprecated in favor of "artifactory.ScopedToken".

api_key str
The API key. Deprecated.

Deprecated: Deprecated in favor of "artifactory.ScopedToken".

apiKey String
The API key. Deprecated.

Deprecated: Deprecated in favor of "artifactory.ScopedToken".

Import

A user’s API key can be imported using any identifier, e.g.

$ pulumi import artifactory:index/apiKey:ApiKey test import
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
artifactory pulumi/pulumi-artifactory
License
Apache-2.0
Notes
This Pulumi package is based on the artifactory Terraform Provider.