@pulumi/fastly
Version:
A Pulumi package for creating and managing fastly cloud resources.. Based on terraform-provider-fastly: version v4
187 lines (186 loc) • 7.26 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
/**
* Uploads a custom TLS certificate to Fastly to be used to terminate TLS traffic.
*
* > Each TLS certificate **must** have its corresponding private key uploaded _prior_ to uploading the certificate. This
* can be achieved in Pulumi using `dependsOn`
*
* ## Example Usage
*
* Basic usage:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as fastly from "@pulumi/fastly";
* import * as tls from "@pulumi/tls";
*
* const key = new tls.PrivateKey("key", {algorithm: "RSA"});
* const cert = new tls.SelfSignedCert("cert", {
* keyAlgorithm: key.algorithm,
* privateKeyPem: key.privateKeyPem,
* subject: [{
* commonName: "example.com",
* }],
* isCaCertificate: true,
* validityPeriodHours: 360,
* allowedUses: [
* "cert_signing",
* "server_auth",
* ],
* dnsNames: ["example.com"],
* });
* const keyTlsPrivateKey = new fastly.TlsPrivateKey("key", {
* keyPem: key.privateKeyPem,
* name: "tf-demo",
* });
* const example = new fastly.TlsCertificate("example", {
* name: "tf-demo",
* certificateBody: cert.certPem,
* }, {
* dependsOn: [keyTlsPrivateKey],
* });
* ```
*
* ## Updating certificates
*
* There are three scenarios for updating a certificate:
*
* 1. The certificate is about to expire but the private key stays the same.
* 2. The certificate is about to expire but the private key is changing.
* 3. The domains on the certificate are changing.
*
* In the first scenario you only need to update the `certificateBody` attribute of the `fastly.TlsCertificate` resource, while the other scenarios require a new private key (`fastly.TlsPrivateKey`) and certificate (`fastly.TlsCertificate`) to be generated.
*
* When updating both the `fastly.TlsPrivateKey` and `fastly.TlsCertificate` resources, they should be done in multiple plan/apply steps to avoid potential downtime. The new certificate and associated private key must first be created so they exist alongside the currently active resources. Once the new resources have been created, then the `fastly.TlsActivation` can be updated to point to the new certificate. Finally, the original key/certificate resources can be deleted.
*
* ## Import
*
* A certificate can be imported using its Fastly certificate ID, e.g.
*
* ```sh
* $ pulumi import fastly:index/tlsCertificate:TlsCertificate demo xxxxxxxxxxx
* ```
*/
export declare class TlsCertificate extends pulumi.CustomResource {
/**
* Get an existing TlsCertificate resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: TlsCertificateState, opts?: pulumi.CustomResourceOptions): TlsCertificate;
/**
* Returns true if the given object is an instance of TlsCertificate. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is TlsCertificate;
/**
* PEM-formatted certificate, optionally including any intermediary certificates.
*/
readonly certificateBody: pulumi.Output<string>;
/**
* Timestamp (GMT) when the certificate was created.
*/
readonly createdAt: pulumi.Output<string>;
/**
* All the domains (including wildcard domains) that are listed in the certificate's Subject Alternative Names (SAN) list.
*/
readonly domains: pulumi.Output<string[]>;
/**
* The hostname for which a certificate was issued.
*/
readonly issuedTo: pulumi.Output<string>;
/**
* The certificate authority that issued the certificate.
*/
readonly issuer: pulumi.Output<string>;
/**
* Human-readable name used to identify the certificate. Defaults to the certificate's Common Name or first Subject Alternative Name entry.
*/
readonly name: pulumi.Output<string>;
/**
* A recommendation from Fastly indicating the key associated with this certificate is in need of rotation.
*/
readonly replace: pulumi.Output<boolean>;
/**
* A value assigned by the issuer that is unique to a certificate.
*/
readonly serialNumber: pulumi.Output<string>;
/**
* The algorithm used to sign the certificate.
*/
readonly signatureAlgorithm: pulumi.Output<string>;
/**
* Timestamp (GMT) when the certificate was last updated.
*/
readonly updatedAt: pulumi.Output<string>;
/**
* Create a TlsCertificate resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: TlsCertificateArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering TlsCertificate resources.
*/
export interface TlsCertificateState {
/**
* PEM-formatted certificate, optionally including any intermediary certificates.
*/
certificateBody?: pulumi.Input<string>;
/**
* Timestamp (GMT) when the certificate was created.
*/
createdAt?: pulumi.Input<string>;
/**
* All the domains (including wildcard domains) that are listed in the certificate's Subject Alternative Names (SAN) list.
*/
domains?: pulumi.Input<pulumi.Input<string>[]>;
/**
* The hostname for which a certificate was issued.
*/
issuedTo?: pulumi.Input<string>;
/**
* The certificate authority that issued the certificate.
*/
issuer?: pulumi.Input<string>;
/**
* Human-readable name used to identify the certificate. Defaults to the certificate's Common Name or first Subject Alternative Name entry.
*/
name?: pulumi.Input<string>;
/**
* A recommendation from Fastly indicating the key associated with this certificate is in need of rotation.
*/
replace?: pulumi.Input<boolean>;
/**
* A value assigned by the issuer that is unique to a certificate.
*/
serialNumber?: pulumi.Input<string>;
/**
* The algorithm used to sign the certificate.
*/
signatureAlgorithm?: pulumi.Input<string>;
/**
* Timestamp (GMT) when the certificate was last updated.
*/
updatedAt?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a TlsCertificate resource.
*/
export interface TlsCertificateArgs {
/**
* PEM-formatted certificate, optionally including any intermediary certificates.
*/
certificateBody: pulumi.Input<string>;
/**
* Human-readable name used to identify the certificate. Defaults to the certificate's Common Name or first Subject Alternative Name entry.
*/
name?: pulumi.Input<string>;
}