1. Packages
  2. Hcloud Provider
  3. API Docs
  4. UploadedCertificate
Hetzner Cloud v1.22.0 published on Wednesday, Feb 26, 2025 by Pulumi

hcloud.UploadedCertificate

Explore with Pulumi AI

Upload a TLS certificate to Hetzner Cloud.

Example Usage

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

const sampleCertificate = new hcloud.UploadedCertificate("sample_certificate", {
    name: "test-certificate-%d",
    privateKey: `-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAorPccsHibgGLJIub5Sb1yvDvARifoKzg7MIhyAYLnJkGn9B1
...
AHcjLFCNvobInLHTTmCoAxYBmEv2eakas0+n4g/LM2Ukaw1Bz+3VrVo=
-----END RSA PRIVATE KEY-----
`,
    certificate: `-----BEGIN CERTIFICATE-----
MIIDMDCCAhigAwIBAgIIJgROscP8RRUwDQYJKoZIhvcNAQELBQAwIDEeMBwGA1UE
...
TKS8gQ==
-----END CERTIFICATE-----
`,
    labels: {
        label_1: "value_1",
        label_2: "value_2",
    },
});
Copy
import pulumi
import pulumi_hcloud as hcloud

sample_certificate = hcloud.UploadedCertificate("sample_certificate",
    name="test-certificate-%d",
    private_key="""-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAorPccsHibgGLJIub5Sb1yvDvARifoKzg7MIhyAYLnJkGn9B1
...
AHcjLFCNvobInLHTTmCoAxYBmEv2eakas0+n4g/LM2Ukaw1Bz+3VrVo=
-----END RSA PRIVATE KEY-----
""",
    certificate="""-----BEGIN CERTIFICATE-----
MIIDMDCCAhigAwIBAgIIJgROscP8RRUwDQYJKoZIhvcNAQELBQAwIDEeMBwGA1UE
...
TKS8gQ==
-----END CERTIFICATE-----
""",
    labels={
        "label_1": "value_1",
        "label_2": "value_2",
    })
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := hcloud.NewUploadedCertificate(ctx, "sample_certificate", &hcloud.UploadedCertificateArgs{
			Name: pulumi.String("test-certificate-%d"),
			PrivateKey: pulumi.String(`-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAorPccsHibgGLJIub5Sb1yvDvARifoKzg7MIhyAYLnJkGn9B1
...
AHcjLFCNvobInLHTTmCoAxYBmEv2eakas0+n4g/LM2Ukaw1Bz+3VrVo=
-----END RSA PRIVATE KEY-----
`),
			Certificate: pulumi.String(`-----BEGIN CERTIFICATE-----
MIIDMDCCAhigAwIBAgIIJgROscP8RRUwDQYJKoZIhvcNAQELBQAwIDEeMBwGA1UE
...
TKS8gQ==
-----END CERTIFICATE-----
`),
			Labels: pulumi.StringMap{
				"label_1": pulumi.String("value_1"),
				"label_2": pulumi.String("value_2"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using HCloud = Pulumi.HCloud;

return await Deployment.RunAsync(() => 
{
    var sampleCertificate = new HCloud.UploadedCertificate("sample_certificate", new()
    {
        Name = "test-certificate-%d",
        PrivateKey = @"-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAorPccsHibgGLJIub5Sb1yvDvARifoKzg7MIhyAYLnJkGn9B1
...
AHcjLFCNvobInLHTTmCoAxYBmEv2eakas0+n4g/LM2Ukaw1Bz+3VrVo=
-----END RSA PRIVATE KEY-----
",
        Certificate = @"-----BEGIN CERTIFICATE-----
MIIDMDCCAhigAwIBAgIIJgROscP8RRUwDQYJKoZIhvcNAQELBQAwIDEeMBwGA1UE
...
TKS8gQ==
-----END CERTIFICATE-----
",
        Labels = 
        {
            { "label_1", "value_1" },
            { "label_2", "value_2" },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.hcloud.UploadedCertificate;
import com.pulumi.hcloud.UploadedCertificateArgs;
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 sampleCertificate = new UploadedCertificate("sampleCertificate", UploadedCertificateArgs.builder()
            .name("test-certificate-%d")
            .privateKey("""
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAorPccsHibgGLJIub5Sb1yvDvARifoKzg7MIhyAYLnJkGn9B1
...
AHcjLFCNvobInLHTTmCoAxYBmEv2eakas0+n4g/LM2Ukaw1Bz+3VrVo=
-----END RSA PRIVATE KEY-----
            """)
            .certificate("""
-----BEGIN CERTIFICATE-----
MIIDMDCCAhigAwIBAgIIJgROscP8RRUwDQYJKoZIhvcNAQELBQAwIDEeMBwGA1UE
...
TKS8gQ==
-----END CERTIFICATE-----
            """)
            .labels(Map.ofEntries(
                Map.entry("label_1", "value_1"),
                Map.entry("label_2", "value_2")
            ))
            .build());

    }
}
Copy
resources:
  sampleCertificate:
    type: hcloud:UploadedCertificate
    name: sample_certificate
    properties:
      name: test-certificate-%d
      privateKey: |
        -----BEGIN RSA PRIVATE KEY-----
        MIIEpQIBAAKCAQEAorPccsHibgGLJIub5Sb1yvDvARifoKzg7MIhyAYLnJkGn9B1
        ...
        AHcjLFCNvobInLHTTmCoAxYBmEv2eakas0+n4g/LM2Ukaw1Bz+3VrVo=
        -----END RSA PRIVATE KEY-----        
      certificate: |
        -----BEGIN CERTIFICATE-----
        MIIDMDCCAhigAwIBAgIIJgROscP8RRUwDQYJKoZIhvcNAQELBQAwIDEeMBwGA1UE
        ...
        TKS8gQ==
        -----END CERTIFICATE-----        
      labels:
        label_1: value_1
        label_2: value_2
Copy

Create UploadedCertificate Resource

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

Constructor syntax

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

@overload
def UploadedCertificate(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        certificate: Optional[str] = None,
                        private_key: Optional[str] = None,
                        labels: Optional[Mapping[str, str]] = None,
                        name: Optional[str] = None)
func NewUploadedCertificate(ctx *Context, name string, args UploadedCertificateArgs, opts ...ResourceOption) (*UploadedCertificate, error)
public UploadedCertificate(string name, UploadedCertificateArgs args, CustomResourceOptions? opts = null)
public UploadedCertificate(String name, UploadedCertificateArgs args)
public UploadedCertificate(String name, UploadedCertificateArgs args, CustomResourceOptions options)
type: hcloud:UploadedCertificate
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 This property is required. UploadedCertificateArgs
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 This property is required. UploadedCertificateArgs
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 This property is required. UploadedCertificateArgs
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 This property is required. UploadedCertificateArgs
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. UploadedCertificateArgs
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 uploadedCertificateResource = new HCloud.UploadedCertificate("uploadedCertificateResource", new()
{
    Certificate = "string",
    PrivateKey = "string",
    Labels = 
    {
        { "string", "string" },
    },
    Name = "string",
});
Copy
example, err := hcloud.NewUploadedCertificate(ctx, "uploadedCertificateResource", &hcloud.UploadedCertificateArgs{
	Certificate: pulumi.String("string"),
	PrivateKey:  pulumi.String("string"),
	Labels: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	Name: pulumi.String("string"),
})
Copy
var uploadedCertificateResource = new UploadedCertificate("uploadedCertificateResource", UploadedCertificateArgs.builder()
    .certificate("string")
    .privateKey("string")
    .labels(Map.of("string", "string"))
    .name("string")
    .build());
Copy
uploaded_certificate_resource = hcloud.UploadedCertificate("uploadedCertificateResource",
    certificate="string",
    private_key="string",
    labels={
        "string": "string",
    },
    name="string")
Copy
const uploadedCertificateResource = new hcloud.UploadedCertificate("uploadedCertificateResource", {
    certificate: "string",
    privateKey: "string",
    labels: {
        string: "string",
    },
    name: "string",
});
Copy
type: hcloud:UploadedCertificate
properties:
    certificate: string
    labels:
        string: string
    name: string
    privateKey: string
Copy

UploadedCertificate 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 UploadedCertificate resource accepts the following input properties:

Certificate
This property is required.
Changes to this property will trigger replacement.
string
PEM encoded TLS certificate.
PrivateKey
This property is required.
Changes to this property will trigger replacement.
string
PEM encoded private key belonging to the certificate.
Labels Dictionary<string, string>
User-defined labels (key-value pairs) the certificate should be created with.
Name string
Name of the Certificate.
Certificate
This property is required.
Changes to this property will trigger replacement.
string
PEM encoded TLS certificate.
PrivateKey
This property is required.
Changes to this property will trigger replacement.
string
PEM encoded private key belonging to the certificate.
Labels map[string]string
User-defined labels (key-value pairs) the certificate should be created with.
Name string
Name of the Certificate.
certificate
This property is required.
Changes to this property will trigger replacement.
String
PEM encoded TLS certificate.
privateKey
This property is required.
Changes to this property will trigger replacement.
String
PEM encoded private key belonging to the certificate.
labels Map<String,String>
User-defined labels (key-value pairs) the certificate should be created with.
name String
Name of the Certificate.
certificate
This property is required.
Changes to this property will trigger replacement.
string
PEM encoded TLS certificate.
privateKey
This property is required.
Changes to this property will trigger replacement.
string
PEM encoded private key belonging to the certificate.
labels {[key: string]: string}
User-defined labels (key-value pairs) the certificate should be created with.
name string
Name of the Certificate.
certificate
This property is required.
Changes to this property will trigger replacement.
str
PEM encoded TLS certificate.
private_key
This property is required.
Changes to this property will trigger replacement.
str
PEM encoded private key belonging to the certificate.
labels Mapping[str, str]
User-defined labels (key-value pairs) the certificate should be created with.
name str
Name of the Certificate.
certificate
This property is required.
Changes to this property will trigger replacement.
String
PEM encoded TLS certificate.
privateKey
This property is required.
Changes to this property will trigger replacement.
String
PEM encoded private key belonging to the certificate.
labels Map<String>
User-defined labels (key-value pairs) the certificate should be created with.
name String
Name of the Certificate.

Outputs

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

Created string
(string) Point in time when the Certificate was created at Hetzner Cloud (in ISO-8601 format).
DomainNames List<string>
(list) Domains and subdomains covered by the certificate.
Fingerprint string
(string) Fingerprint of the certificate.
Id string
The provider-assigned unique ID for this managed resource.
NotValidAfter string
(string) Point in time when the Certificate stops being valid (in ISO-8601 format).
NotValidBefore string
(string) Point in time when the Certificate becomes valid (in ISO-8601 format).
Type string
Created string
(string) Point in time when the Certificate was created at Hetzner Cloud (in ISO-8601 format).
DomainNames []string
(list) Domains and subdomains covered by the certificate.
Fingerprint string
(string) Fingerprint of the certificate.
Id string
The provider-assigned unique ID for this managed resource.
NotValidAfter string
(string) Point in time when the Certificate stops being valid (in ISO-8601 format).
NotValidBefore string
(string) Point in time when the Certificate becomes valid (in ISO-8601 format).
Type string
created String
(string) Point in time when the Certificate was created at Hetzner Cloud (in ISO-8601 format).
domainNames List<String>
(list) Domains and subdomains covered by the certificate.
fingerprint String
(string) Fingerprint of the certificate.
id String
The provider-assigned unique ID for this managed resource.
notValidAfter String
(string) Point in time when the Certificate stops being valid (in ISO-8601 format).
notValidBefore String
(string) Point in time when the Certificate becomes valid (in ISO-8601 format).
type String
created string
(string) Point in time when the Certificate was created at Hetzner Cloud (in ISO-8601 format).
domainNames string[]
(list) Domains and subdomains covered by the certificate.
fingerprint string
(string) Fingerprint of the certificate.
id string
The provider-assigned unique ID for this managed resource.
notValidAfter string
(string) Point in time when the Certificate stops being valid (in ISO-8601 format).
notValidBefore string
(string) Point in time when the Certificate becomes valid (in ISO-8601 format).
type string
created str
(string) Point in time when the Certificate was created at Hetzner Cloud (in ISO-8601 format).
domain_names Sequence[str]
(list) Domains and subdomains covered by the certificate.
fingerprint str
(string) Fingerprint of the certificate.
id str
The provider-assigned unique ID for this managed resource.
not_valid_after str
(string) Point in time when the Certificate stops being valid (in ISO-8601 format).
not_valid_before str
(string) Point in time when the Certificate becomes valid (in ISO-8601 format).
type str
created String
(string) Point in time when the Certificate was created at Hetzner Cloud (in ISO-8601 format).
domainNames List<String>
(list) Domains and subdomains covered by the certificate.
fingerprint String
(string) Fingerprint of the certificate.
id String
The provider-assigned unique ID for this managed resource.
notValidAfter String
(string) Point in time when the Certificate stops being valid (in ISO-8601 format).
notValidBefore String
(string) Point in time when the Certificate becomes valid (in ISO-8601 format).
type String

Look up Existing UploadedCertificate Resource

Get an existing UploadedCertificate 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?: UploadedCertificateState, opts?: CustomResourceOptions): UploadedCertificate
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        certificate: Optional[str] = None,
        created: Optional[str] = None,
        domain_names: Optional[Sequence[str]] = None,
        fingerprint: Optional[str] = None,
        labels: Optional[Mapping[str, str]] = None,
        name: Optional[str] = None,
        not_valid_after: Optional[str] = None,
        not_valid_before: Optional[str] = None,
        private_key: Optional[str] = None,
        type: Optional[str] = None) -> UploadedCertificate
func GetUploadedCertificate(ctx *Context, name string, id IDInput, state *UploadedCertificateState, opts ...ResourceOption) (*UploadedCertificate, error)
public static UploadedCertificate Get(string name, Input<string> id, UploadedCertificateState? state, CustomResourceOptions? opts = null)
public static UploadedCertificate get(String name, Output<String> id, UploadedCertificateState state, CustomResourceOptions options)
resources:  _:    type: hcloud:UploadedCertificate    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:
Certificate Changes to this property will trigger replacement. string
PEM encoded TLS certificate.
Created string
(string) Point in time when the Certificate was created at Hetzner Cloud (in ISO-8601 format).
DomainNames List<string>
(list) Domains and subdomains covered by the certificate.
Fingerprint string
(string) Fingerprint of the certificate.
Labels Dictionary<string, string>
User-defined labels (key-value pairs) the certificate should be created with.
Name string
Name of the Certificate.
NotValidAfter string
(string) Point in time when the Certificate stops being valid (in ISO-8601 format).
NotValidBefore string
(string) Point in time when the Certificate becomes valid (in ISO-8601 format).
PrivateKey Changes to this property will trigger replacement. string
PEM encoded private key belonging to the certificate.
Type string
Certificate Changes to this property will trigger replacement. string
PEM encoded TLS certificate.
Created string
(string) Point in time when the Certificate was created at Hetzner Cloud (in ISO-8601 format).
DomainNames []string
(list) Domains and subdomains covered by the certificate.
Fingerprint string
(string) Fingerprint of the certificate.
Labels map[string]string
User-defined labels (key-value pairs) the certificate should be created with.
Name string
Name of the Certificate.
NotValidAfter string
(string) Point in time when the Certificate stops being valid (in ISO-8601 format).
NotValidBefore string
(string) Point in time when the Certificate becomes valid (in ISO-8601 format).
PrivateKey Changes to this property will trigger replacement. string
PEM encoded private key belonging to the certificate.
Type string
certificate Changes to this property will trigger replacement. String
PEM encoded TLS certificate.
created String
(string) Point in time when the Certificate was created at Hetzner Cloud (in ISO-8601 format).
domainNames List<String>
(list) Domains and subdomains covered by the certificate.
fingerprint String
(string) Fingerprint of the certificate.
labels Map<String,String>
User-defined labels (key-value pairs) the certificate should be created with.
name String
Name of the Certificate.
notValidAfter String
(string) Point in time when the Certificate stops being valid (in ISO-8601 format).
notValidBefore String
(string) Point in time when the Certificate becomes valid (in ISO-8601 format).
privateKey Changes to this property will trigger replacement. String
PEM encoded private key belonging to the certificate.
type String
certificate Changes to this property will trigger replacement. string
PEM encoded TLS certificate.
created string
(string) Point in time when the Certificate was created at Hetzner Cloud (in ISO-8601 format).
domainNames string[]
(list) Domains and subdomains covered by the certificate.
fingerprint string
(string) Fingerprint of the certificate.
labels {[key: string]: string}
User-defined labels (key-value pairs) the certificate should be created with.
name string
Name of the Certificate.
notValidAfter string
(string) Point in time when the Certificate stops being valid (in ISO-8601 format).
notValidBefore string
(string) Point in time when the Certificate becomes valid (in ISO-8601 format).
privateKey Changes to this property will trigger replacement. string
PEM encoded private key belonging to the certificate.
type string
certificate Changes to this property will trigger replacement. str
PEM encoded TLS certificate.
created str
(string) Point in time when the Certificate was created at Hetzner Cloud (in ISO-8601 format).
domain_names Sequence[str]
(list) Domains and subdomains covered by the certificate.
fingerprint str
(string) Fingerprint of the certificate.
labels Mapping[str, str]
User-defined labels (key-value pairs) the certificate should be created with.
name str
Name of the Certificate.
not_valid_after str
(string) Point in time when the Certificate stops being valid (in ISO-8601 format).
not_valid_before str
(string) Point in time when the Certificate becomes valid (in ISO-8601 format).
private_key Changes to this property will trigger replacement. str
PEM encoded private key belonging to the certificate.
type str
certificate Changes to this property will trigger replacement. String
PEM encoded TLS certificate.
created String
(string) Point in time when the Certificate was created at Hetzner Cloud (in ISO-8601 format).
domainNames List<String>
(list) Domains and subdomains covered by the certificate.
fingerprint String
(string) Fingerprint of the certificate.
labels Map<String>
User-defined labels (key-value pairs) the certificate should be created with.
name String
Name of the Certificate.
notValidAfter String
(string) Point in time when the Certificate stops being valid (in ISO-8601 format).
notValidBefore String
(string) Point in time when the Certificate becomes valid (in ISO-8601 format).
privateKey Changes to this property will trigger replacement. String
PEM encoded private key belonging to the certificate.
type String

Import

Uploaded certificates can be imported using their id:

$ pulumi import hcloud:index/uploadedCertificate:UploadedCertificate example "$CERTIFICATE_ID"
Copy

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

Package Details

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