artifactory logo
artifactory v3.5.2, May 23 23

artifactory.Certificate

Explore with Pulumi AI

Provides an Artifactory certificate resource. This can be used to create and manage Artifactory certificates which can be used as client authentication against remote repositories.

Example Usage

using System.Collections.Generic;
using System.IO;
using System.Linq;
using Pulumi;
using Artifactory = Pulumi.Artifactory;

return await Deployment.RunAsync(() => 
{
    // Create a new Artifactory certificate called my-cert
    var my_cert = new Artifactory.Certificate("my-cert", new()
    {
        Alias = "my-cert",
        Content = File.ReadAllText("/path/to/bundle.pem"),
    });

    // This can then be used by a remote repository
    var my_remote = new Artifactory.RemoteMavenRepository("my-remote", new()
    {
        ClientTlsCertificate = my_cert.Alias,
    });

});
package main

import (
	"os"

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

func readFileOrPanic(path string) pulumi.StringPtrInput {
	data, err := os.ReadFile(path)
	if err != nil {
		panic(err.Error())
	}
	return pulumi.String(string(data))
}

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := artifactory.NewCertificate(ctx, "my-cert", &artifactory.CertificateArgs{
			Alias:   pulumi.String("my-cert"),
			Content: readFileOrPanic("/path/to/bundle.pem"),
		})
		if err != nil {
			return err
		}
		_, err = artifactory.NewRemoteMavenRepository(ctx, "my-remote", &artifactory.RemoteMavenRepositoryArgs{
			ClientTlsCertificate: my_cert.Alias,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.artifactory.Certificate;
import com.pulumi.artifactory.CertificateArgs;
import com.pulumi.artifactory.RemoteMavenRepository;
import com.pulumi.artifactory.RemoteMavenRepositoryArgs;
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) {
        var my_cert = new Certificate("my-cert", CertificateArgs.builder()        
            .alias("my-cert")
            .content(Files.readString(Paths.get("/path/to/bundle.pem")))
            .build());

        var my_remote = new RemoteMavenRepository("my-remote", RemoteMavenRepositoryArgs.builder()        
            .clientTlsCertificate(my_cert.alias())
            .build());

    }
}
import pulumi
import pulumi_artifactory as artifactory

# Create a new Artifactory certificate called my-cert
my_cert = artifactory.Certificate("my-cert",
    alias="my-cert",
    content=(lambda path: open(path).read())("/path/to/bundle.pem"))
# This can then be used by a remote repository
my_remote = artifactory.RemoteMavenRepository("my-remote", client_tls_certificate=my_cert.alias)
import * as pulumi from "@pulumi/pulumi";
import * as artifactory from "@pulumi/artifactory";
import * as fs from "fs";

// Create a new Artifactory certificate called my-cert
const my_cert = new artifactory.Certificate("my-cert", {
    alias: "my-cert",
    content: fs.readFileSync("/path/to/bundle.pem"),
});
// This can then be used by a remote repository
const my_remote = new artifactory.RemoteMavenRepository("my-remote", {clientTlsCertificate: my_cert.alias});
resources:
  # Create a new Artifactory certificate called my-cert
  my-cert:
    type: artifactory:Certificate
    properties:
      alias: my-cert
      content:
        fn::readFile: /path/to/bundle.pem
  # This can then be used by a remote repository
  my-remote:
    type: artifactory:RemoteMavenRepository
    properties:
      # more code
      clientTlsCertificate: ${["my-cert"].alias}

Create Certificate Resource

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

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

Certificate Resource Properties

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

Inputs

The Certificate resource accepts the following input properties:

Alias string

Name of certificate.

Content string

PEM-encoded client certificate and private key.

File string
Alias string

Name of certificate.

Content string

PEM-encoded client certificate and private key.

File string
alias String

Name of certificate.

content String

PEM-encoded client certificate and private key.

file String
alias string

Name of certificate.

content string

PEM-encoded client certificate and private key.

file string
alias str

Name of certificate.

content str

PEM-encoded client certificate and private key.

file str
alias String

Name of certificate.

content String

PEM-encoded client certificate and private key.

file String

Outputs

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

Fingerprint string

SHA256 fingerprint of the certificate.

Id string

The provider-assigned unique ID for this managed resource.

IssuedBy string

Name of the certificate authority that issued the certificate.

IssuedOn string

The time & date when the certificate is valid from.

IssuedTo string

Name of whom the certificate has been issued to.

ValidUntil string

The time & date when the certificate expires.

Fingerprint string

SHA256 fingerprint of the certificate.

Id string

The provider-assigned unique ID for this managed resource.

IssuedBy string

Name of the certificate authority that issued the certificate.

IssuedOn string

The time & date when the certificate is valid from.

IssuedTo string

Name of whom the certificate has been issued to.

ValidUntil string

The time & date when the certificate expires.

fingerprint String

SHA256 fingerprint of the certificate.

id String

The provider-assigned unique ID for this managed resource.

issuedBy String

Name of the certificate authority that issued the certificate.

issuedOn String

The time & date when the certificate is valid from.

issuedTo String

Name of whom the certificate has been issued to.

validUntil String

The time & date when the certificate expires.

fingerprint string

SHA256 fingerprint of the certificate.

id string

The provider-assigned unique ID for this managed resource.

issuedBy string

Name of the certificate authority that issued the certificate.

issuedOn string

The time & date when the certificate is valid from.

issuedTo string

Name of whom the certificate has been issued to.

validUntil string

The time & date when the certificate expires.

fingerprint str

SHA256 fingerprint of the certificate.

id str

The provider-assigned unique ID for this managed resource.

issued_by str

Name of the certificate authority that issued the certificate.

issued_on str

The time & date when the certificate is valid from.

issued_to str

Name of whom the certificate has been issued to.

valid_until str

The time & date when the certificate expires.

fingerprint String

SHA256 fingerprint of the certificate.

id String

The provider-assigned unique ID for this managed resource.

issuedBy String

Name of the certificate authority that issued the certificate.

issuedOn String

The time & date when the certificate is valid from.

issuedTo String

Name of whom the certificate has been issued to.

validUntil String

The time & date when the certificate expires.

Look up Existing Certificate Resource

Get an existing Certificate 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?: CertificateState, opts?: CustomResourceOptions): Certificate
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        alias: Optional[str] = None,
        content: Optional[str] = None,
        file: Optional[str] = None,
        fingerprint: Optional[str] = None,
        issued_by: Optional[str] = None,
        issued_on: Optional[str] = None,
        issued_to: Optional[str] = None,
        valid_until: Optional[str] = None) -> Certificate
func GetCertificate(ctx *Context, name string, id IDInput, state *CertificateState, opts ...ResourceOption) (*Certificate, error)
public static Certificate Get(string name, Input<string> id, CertificateState? state, CustomResourceOptions? opts = null)
public static Certificate get(String name, Output<String> id, CertificateState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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:
Alias string

Name of certificate.

Content string

PEM-encoded client certificate and private key.

File string
Fingerprint string

SHA256 fingerprint of the certificate.

IssuedBy string

Name of the certificate authority that issued the certificate.

IssuedOn string

The time & date when the certificate is valid from.

IssuedTo string

Name of whom the certificate has been issued to.

ValidUntil string

The time & date when the certificate expires.

Alias string

Name of certificate.

Content string

PEM-encoded client certificate and private key.

File string
Fingerprint string

SHA256 fingerprint of the certificate.

IssuedBy string

Name of the certificate authority that issued the certificate.

IssuedOn string

The time & date when the certificate is valid from.

IssuedTo string

Name of whom the certificate has been issued to.

ValidUntil string

The time & date when the certificate expires.

alias String

Name of certificate.

content String

PEM-encoded client certificate and private key.

file String
fingerprint String

SHA256 fingerprint of the certificate.

issuedBy String

Name of the certificate authority that issued the certificate.

issuedOn String

The time & date when the certificate is valid from.

issuedTo String

Name of whom the certificate has been issued to.

validUntil String

The time & date when the certificate expires.

alias string

Name of certificate.

content string

PEM-encoded client certificate and private key.

file string
fingerprint string

SHA256 fingerprint of the certificate.

issuedBy string

Name of the certificate authority that issued the certificate.

issuedOn string

The time & date when the certificate is valid from.

issuedTo string

Name of whom the certificate has been issued to.

validUntil string

The time & date when the certificate expires.

alias str

Name of certificate.

content str

PEM-encoded client certificate and private key.

file str
fingerprint str

SHA256 fingerprint of the certificate.

issued_by str

Name of the certificate authority that issued the certificate.

issued_on str

The time & date when the certificate is valid from.

issued_to str

Name of whom the certificate has been issued to.

valid_until str

The time & date when the certificate expires.

alias String

Name of certificate.

content String

PEM-encoded client certificate and private key.

file String
fingerprint String

SHA256 fingerprint of the certificate.

issuedBy String

Name of the certificate authority that issued the certificate.

issuedOn String

The time & date when the certificate is valid from.

issuedTo String

Name of whom the certificate has been issued to.

validUntil String

The time & date when the certificate expires.

Import

Certificates can be imported using their alias, e.g.

 $ pulumi import artifactory:index/certificate:Certificate my-cert my-cert

Package Details

Repository
artifactory pulumi/pulumi-artifactory
License
Apache-2.0
Notes

This Pulumi package is based on the artifactory Terraform Provider.