1. Packages
  2. Fastly Provider
  3. API Docs
  4. TlsPrivateKey
Fastly v9.1.0 published on Friday, Apr 18, 2025 by Pulumi

fastly.TlsPrivateKey

Explore with Pulumi AI

Uploads a Custom TLS Private Key to Fastly. This can be combined with a fastly.TlsCertificate resource to provide a TLS Certificate able to be applied to a Fastly Service.

The Private Key resource requires a key in PEM format, and a name to identify it.

Example Usage

Basic usage:

import * as pulumi from "@pulumi/pulumi";
import * as fastly from "@pulumi/fastly";
import * as tls from "@pulumi/tls";

const demo = new tls.index.PrivateKey("demo", {algorithm: "RSA"});
const demoTlsPrivateKey = new fastly.TlsPrivateKey("demo", {
    keyPem: demo.privateKeyPem,
    name: "tf-demo",
});
Copy
import pulumi
import pulumi_fastly as fastly
import pulumi_tls as tls

demo = tls.index.PrivateKey("demo", algorithm=RSA)
demo_tls_private_key = fastly.TlsPrivateKey("demo",
    key_pem=demo["privateKeyPem"],
    name="tf-demo")
Copy
package main

import (
	"github.com/pulumi/pulumi-fastly/sdk/v9/go/fastly"
	"github.com/pulumi/pulumi-tls/sdk/v4/go/tls"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		demo, err := tls.NewPrivateKey(ctx, "demo", &tls.PrivateKeyArgs{
			Algorithm: "RSA",
		})
		if err != nil {
			return err
		}
		_, err = fastly.NewTlsPrivateKey(ctx, "demo", &fastly.TlsPrivateKeyArgs{
			KeyPem: demo.PrivateKeyPem,
			Name:   pulumi.String("tf-demo"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Fastly = Pulumi.Fastly;
using Tls = Pulumi.Tls;

return await Deployment.RunAsync(() => 
{
    var demo = new Tls.Index.PrivateKey("demo", new()
    {
        Algorithm = "RSA",
    });

    var demoTlsPrivateKey = new Fastly.TlsPrivateKey("demo", new()
    {
        KeyPem = demo.PrivateKeyPem,
        Name = "tf-demo",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tls.privateKey;
import com.pulumi.tls.privateKeyArgs;
import com.pulumi.fastly.TlsPrivateKey;
import com.pulumi.fastly.TlsPrivateKeyArgs;
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 demo = new PrivateKey("demo", PrivateKeyArgs.builder()
            .algorithm("RSA")
            .build());

        var demoTlsPrivateKey = new TlsPrivateKey("demoTlsPrivateKey", TlsPrivateKeyArgs.builder()
            .keyPem(demo.privateKeyPem())
            .name("tf-demo")
            .build());

    }
}
Copy
resources:
  demo:
    type: tls:privateKey
    properties:
      algorithm: RSA
  demoTlsPrivateKey:
    type: fastly:TlsPrivateKey
    name: demo
    properties:
      keyPem: ${demo.privateKeyPem}
      name: tf-demo
Copy

Create TlsPrivateKey Resource

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

Constructor syntax

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

@overload
def TlsPrivateKey(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  key_pem: Optional[str] = None,
                  name: Optional[str] = None)
func NewTlsPrivateKey(ctx *Context, name string, args TlsPrivateKeyArgs, opts ...ResourceOption) (*TlsPrivateKey, error)
public TlsPrivateKey(string name, TlsPrivateKeyArgs args, CustomResourceOptions? opts = null)
public TlsPrivateKey(String name, TlsPrivateKeyArgs args)
public TlsPrivateKey(String name, TlsPrivateKeyArgs args, CustomResourceOptions options)
type: fastly:TlsPrivateKey
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. TlsPrivateKeyArgs
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. TlsPrivateKeyArgs
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. TlsPrivateKeyArgs
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. TlsPrivateKeyArgs
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. TlsPrivateKeyArgs
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 tlsPrivateKeyResource = new Fastly.TlsPrivateKey("tlsPrivateKeyResource", new()
{
    KeyPem = "string",
    Name = "string",
});
Copy
example, err := fastly.NewTlsPrivateKey(ctx, "tlsPrivateKeyResource", &fastly.TlsPrivateKeyArgs{
	KeyPem: pulumi.String("string"),
	Name:   pulumi.String("string"),
})
Copy
var tlsPrivateKeyResource = new TlsPrivateKey("tlsPrivateKeyResource", TlsPrivateKeyArgs.builder()
    .keyPem("string")
    .name("string")
    .build());
Copy
tls_private_key_resource = fastly.TlsPrivateKey("tlsPrivateKeyResource",
    key_pem="string",
    name="string")
Copy
const tlsPrivateKeyResource = new fastly.TlsPrivateKey("tlsPrivateKeyResource", {
    keyPem: "string",
    name: "string",
});
Copy
type: fastly:TlsPrivateKey
properties:
    keyPem: string
    name: string
Copy

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

KeyPem
This property is required.
Changes to this property will trigger replacement.
string
Private key in PEM format.
Name Changes to this property will trigger replacement. string
Customisable name of the private key.
KeyPem
This property is required.
Changes to this property will trigger replacement.
string
Private key in PEM format.
Name Changes to this property will trigger replacement. string
Customisable name of the private key.
keyPem
This property is required.
Changes to this property will trigger replacement.
String
Private key in PEM format.
name Changes to this property will trigger replacement. String
Customisable name of the private key.
keyPem
This property is required.
Changes to this property will trigger replacement.
string
Private key in PEM format.
name Changes to this property will trigger replacement. string
Customisable name of the private key.
key_pem
This property is required.
Changes to this property will trigger replacement.
str
Private key in PEM format.
name Changes to this property will trigger replacement. str
Customisable name of the private key.
keyPem
This property is required.
Changes to this property will trigger replacement.
String
Private key in PEM format.
name Changes to this property will trigger replacement. String
Customisable name of the private key.

Outputs

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

CreatedAt string
Time-stamp (GMT) when the private key was created.
Id string
The provider-assigned unique ID for this managed resource.
KeyLength int
The key length used to generate the private key.
KeyType string
The algorithm used to generate the private key. Must be RSA.
PublicKeySha1 string
Useful for safely identifying the key.
Replace bool
Whether Fastly recommends replacing this private key.
CreatedAt string
Time-stamp (GMT) when the private key was created.
Id string
The provider-assigned unique ID for this managed resource.
KeyLength int
The key length used to generate the private key.
KeyType string
The algorithm used to generate the private key. Must be RSA.
PublicKeySha1 string
Useful for safely identifying the key.
Replace bool
Whether Fastly recommends replacing this private key.
createdAt String
Time-stamp (GMT) when the private key was created.
id String
The provider-assigned unique ID for this managed resource.
keyLength Integer
The key length used to generate the private key.
keyType String
The algorithm used to generate the private key. Must be RSA.
publicKeySha1 String
Useful for safely identifying the key.
replace Boolean
Whether Fastly recommends replacing this private key.
createdAt string
Time-stamp (GMT) when the private key was created.
id string
The provider-assigned unique ID for this managed resource.
keyLength number
The key length used to generate the private key.
keyType string
The algorithm used to generate the private key. Must be RSA.
publicKeySha1 string
Useful for safely identifying the key.
replace boolean
Whether Fastly recommends replacing this private key.
created_at str
Time-stamp (GMT) when the private key was created.
id str
The provider-assigned unique ID for this managed resource.
key_length int
The key length used to generate the private key.
key_type str
The algorithm used to generate the private key. Must be RSA.
public_key_sha1 str
Useful for safely identifying the key.
replace bool
Whether Fastly recommends replacing this private key.
createdAt String
Time-stamp (GMT) when the private key was created.
id String
The provider-assigned unique ID for this managed resource.
keyLength Number
The key length used to generate the private key.
keyType String
The algorithm used to generate the private key. Must be RSA.
publicKeySha1 String
Useful for safely identifying the key.
replace Boolean
Whether Fastly recommends replacing this private key.

Look up Existing TlsPrivateKey Resource

Get an existing TlsPrivateKey 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?: TlsPrivateKeyState, opts?: CustomResourceOptions): TlsPrivateKey
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        created_at: Optional[str] = None,
        key_length: Optional[int] = None,
        key_pem: Optional[str] = None,
        key_type: Optional[str] = None,
        name: Optional[str] = None,
        public_key_sha1: Optional[str] = None,
        replace: Optional[bool] = None) -> TlsPrivateKey
func GetTlsPrivateKey(ctx *Context, name string, id IDInput, state *TlsPrivateKeyState, opts ...ResourceOption) (*TlsPrivateKey, error)
public static TlsPrivateKey Get(string name, Input<string> id, TlsPrivateKeyState? state, CustomResourceOptions? opts = null)
public static TlsPrivateKey get(String name, Output<String> id, TlsPrivateKeyState state, CustomResourceOptions options)
resources:  _:    type: fastly:TlsPrivateKey    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:
CreatedAt string
Time-stamp (GMT) when the private key was created.
KeyLength int
The key length used to generate the private key.
KeyPem Changes to this property will trigger replacement. string
Private key in PEM format.
KeyType string
The algorithm used to generate the private key. Must be RSA.
Name Changes to this property will trigger replacement. string
Customisable name of the private key.
PublicKeySha1 string
Useful for safely identifying the key.
Replace bool
Whether Fastly recommends replacing this private key.
CreatedAt string
Time-stamp (GMT) when the private key was created.
KeyLength int
The key length used to generate the private key.
KeyPem Changes to this property will trigger replacement. string
Private key in PEM format.
KeyType string
The algorithm used to generate the private key. Must be RSA.
Name Changes to this property will trigger replacement. string
Customisable name of the private key.
PublicKeySha1 string
Useful for safely identifying the key.
Replace bool
Whether Fastly recommends replacing this private key.
createdAt String
Time-stamp (GMT) when the private key was created.
keyLength Integer
The key length used to generate the private key.
keyPem Changes to this property will trigger replacement. String
Private key in PEM format.
keyType String
The algorithm used to generate the private key. Must be RSA.
name Changes to this property will trigger replacement. String
Customisable name of the private key.
publicKeySha1 String
Useful for safely identifying the key.
replace Boolean
Whether Fastly recommends replacing this private key.
createdAt string
Time-stamp (GMT) when the private key was created.
keyLength number
The key length used to generate the private key.
keyPem Changes to this property will trigger replacement. string
Private key in PEM format.
keyType string
The algorithm used to generate the private key. Must be RSA.
name Changes to this property will trigger replacement. string
Customisable name of the private key.
publicKeySha1 string
Useful for safely identifying the key.
replace boolean
Whether Fastly recommends replacing this private key.
created_at str
Time-stamp (GMT) when the private key was created.
key_length int
The key length used to generate the private key.
key_pem Changes to this property will trigger replacement. str
Private key in PEM format.
key_type str
The algorithm used to generate the private key. Must be RSA.
name Changes to this property will trigger replacement. str
Customisable name of the private key.
public_key_sha1 str
Useful for safely identifying the key.
replace bool
Whether Fastly recommends replacing this private key.
createdAt String
Time-stamp (GMT) when the private key was created.
keyLength Number
The key length used to generate the private key.
keyPem Changes to this property will trigger replacement. String
Private key in PEM format.
keyType String
The algorithm used to generate the private key. Must be RSA.
name Changes to this property will trigger replacement. String
Customisable name of the private key.
publicKeySha1 String
Useful for safely identifying the key.
replace Boolean
Whether Fastly recommends replacing this private key.

Import

A Private Key can be imported using its ID, e.g.

$ pulumi import fastly:index/tlsPrivateKey:TlsPrivateKey demo xxxxxxxxxxx
Copy

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

Package Details

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