@pulumi/fastly
Version:
A Pulumi package for creating and managing fastly cloud resources.. Based on terraform-provider-fastly: version v4
153 lines • 6.12 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.TlsPlatformCertificate = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Uploads a TLS certificate to the Fastly Platform TLS service.
*
* > 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 with self-signed CA:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as fastly from "@pulumi/fastly";
* import * as tls from "@pulumi/tls";
*
* const caKey = new tls.PrivateKey("ca_key", {algorithm: "RSA"});
* const key = new tls.PrivateKey("key", {algorithm: "RSA"});
* const ca = new tls.SelfSignedCert("ca", {
* keyAlgorithm: caKey.algorithm,
* privateKeyPem: caKey.privateKeyPem,
* subject: [{
* commonName: "Example CA",
* }],
* isCaCertificate: true,
* validityPeriodHours: 360,
* allowedUses: [
* "cert_signing",
* "server_auth",
* ],
* });
* const example = new tls.CertRequest("example", {
* keyAlgorithm: key.algorithm,
* privateKeyPem: key.privateKeyPem,
* subject: [{
* commonName: "example.com",
* }],
* dnsNames: [
* "example.com",
* "www.example.com",
* ],
* });
* const cert = new tls.LocallySignedCert("cert", {
* certRequestPem: example.certRequestPem,
* caKeyAlgorithm: caKey.algorithm,
* caPrivateKeyPem: caKey.privateKeyPem,
* caCertPem: ca.certPem,
* validityPeriodHours: 360,
* allowedUses: [
* "cert_signing",
* "server_auth",
* ],
* });
* const config = fastly.getTlsConfiguration({
* tlsService: "PLATFORM",
* });
* const keyTlsPrivateKey = new fastly.TlsPrivateKey("key", {
* keyPem: key.privateKeyPem,
* name: "tf-demo",
* });
* const certTlsPlatformCertificate = new fastly.TlsPlatformCertificate("cert", {
* certificateBody: cert.certPem,
* intermediatesBlob: ca.certPem,
* configurationId: config.then(config => config.id),
* allowUntrustedRoot: true,
* }, {
* dependsOn: [keyTlsPrivateKey],
* });
* ```
*
* ## Import
*
* A certificate can be imported using its Fastly certificate ID, e.g.
*
* ```sh
* $ pulumi import fastly:index/tlsPlatformCertificate:TlsPlatformCertificate demo xxxxxxxxxxx
* ```
*/
class TlsPlatformCertificate extends pulumi.CustomResource {
/**
* Get an existing TlsPlatformCertificate 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, id, state, opts) {
return new TlsPlatformCertificate(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of TlsPlatformCertificate. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === TlsPlatformCertificate.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["allowUntrustedRoot"] = state?.allowUntrustedRoot;
resourceInputs["certificateBody"] = state?.certificateBody;
resourceInputs["configurationId"] = state?.configurationId;
resourceInputs["createdAt"] = state?.createdAt;
resourceInputs["domains"] = state?.domains;
resourceInputs["intermediatesBlob"] = state?.intermediatesBlob;
resourceInputs["notAfter"] = state?.notAfter;
resourceInputs["notBefore"] = state?.notBefore;
resourceInputs["replace"] = state?.replace;
resourceInputs["updatedAt"] = state?.updatedAt;
}
else {
const args = argsOrState;
if (args?.certificateBody === undefined && !opts.urn) {
throw new Error("Missing required property 'certificateBody'");
}
if (args?.configurationId === undefined && !opts.urn) {
throw new Error("Missing required property 'configurationId'");
}
if (args?.intermediatesBlob === undefined && !opts.urn) {
throw new Error("Missing required property 'intermediatesBlob'");
}
resourceInputs["allowUntrustedRoot"] = args?.allowUntrustedRoot;
resourceInputs["certificateBody"] = args?.certificateBody;
resourceInputs["configurationId"] = args?.configurationId;
resourceInputs["intermediatesBlob"] = args?.intermediatesBlob;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["domains"] = undefined /*out*/;
resourceInputs["notAfter"] = undefined /*out*/;
resourceInputs["notBefore"] = undefined /*out*/;
resourceInputs["replace"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(TlsPlatformCertificate.__pulumiType, name, resourceInputs, opts);
}
}
exports.TlsPlatformCertificate = TlsPlatformCertificate;
/** @internal */
TlsPlatformCertificate.__pulumiType = 'fastly:index/tlsPlatformCertificate:TlsPlatformCertificate';
//# sourceMappingURL=tlsPlatformCertificate.js.map