UNPKG

@pulumi/fastly

Version:

A Pulumi package for creating and managing fastly cloud resources.. Based on terraform-provider-fastly: version v4

153 lines 6.47 kB
"use strict"; // *** 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.index.PrivateKey("ca_key", {algorithm: "RSA"}); * const key = new tls.index.PrivateKey("key", {algorithm: "RSA"}); * const ca = new tls.index.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.index.CertRequest("example", { * keyAlgorithm: key.algorithm, * privateKeyPem: key.privateKeyPem, * subject: [{ * commonName: "example.com", * }], * dnsNames: [ * "example.com", * "www.example.com", * ], * }); * const cert = new tls.index.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, Object.assign(Object.assign({}, 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 ? state.allowUntrustedRoot : undefined; resourceInputs["certificateBody"] = state ? state.certificateBody : undefined; resourceInputs["configurationId"] = state ? state.configurationId : undefined; resourceInputs["createdAt"] = state ? state.createdAt : undefined; resourceInputs["domains"] = state ? state.domains : undefined; resourceInputs["intermediatesBlob"] = state ? state.intermediatesBlob : undefined; resourceInputs["notAfter"] = state ? state.notAfter : undefined; resourceInputs["notBefore"] = state ? state.notBefore : undefined; resourceInputs["replace"] = state ? state.replace : undefined; resourceInputs["updatedAt"] = state ? state.updatedAt : undefined; } else { const args = argsOrState; if ((!args || args.certificateBody === undefined) && !opts.urn) { throw new Error("Missing required property 'certificateBody'"); } if ((!args || args.configurationId === undefined) && !opts.urn) { throw new Error("Missing required property 'configurationId'"); } if ((!args || args.intermediatesBlob === undefined) && !opts.urn) { throw new Error("Missing required property 'intermediatesBlob'"); } resourceInputs["allowUntrustedRoot"] = args ? args.allowUntrustedRoot : undefined; resourceInputs["certificateBody"] = args ? args.certificateBody : undefined; resourceInputs["configurationId"] = args ? args.configurationId : undefined; resourceInputs["intermediatesBlob"] = args ? args.intermediatesBlob : undefined; 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