@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
420 lines • 15.2 kB
JavaScript
"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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Certificate = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Certificate represents a HTTP-reachable backend for a Certificate.
*
* To get more information about Certificate, see:
*
* * [API documentation](https://docs.cloud.google.com/certificate-manager/docs/reference/certificate-manager/rest/v1/projects.locations.certificates)
* * How-to Guides
* * [Official Documentation](https://docs.cloud.google.com/certificate-manager/docs/certificates)
*
* ## Example Usage
*
* ### Certificate Manager Google Managed Certificate Dns
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const instance = new gcp.certificatemanager.DnsAuthorization("instance", {
* name: "dns-auth",
* description: "The default dnss",
* domain: "subdomain.hashicorptest.com",
* });
* const instance2 = new gcp.certificatemanager.DnsAuthorization("instance2", {
* name: "dns-auth2",
* description: "The default dnss",
* domain: "subdomain2.hashicorptest.com",
* });
* const _default = new gcp.certificatemanager.Certificate("default", {
* name: "dns-cert",
* description: "The default cert",
* scope: "EDGE_CACHE",
* labels: {
* env: "test",
* },
* managed: {
* domains: [
* instance.domain,
* instance2.domain,
* ],
* dnsAuthorizations: [
* instance.id,
* instance2.id,
* ],
* },
* });
* ```
* ### Certificate Manager Google Managed Certificate Issuance Config
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const pool = new gcp.certificateauthority.CaPool("pool", {
* name: "ca-pool",
* location: "us-central1",
* tier: "ENTERPRISE",
* });
* const caAuthority = new gcp.certificateauthority.Authority("ca_authority", {
* location: "us-central1",
* pool: pool.name,
* certificateAuthorityId: "ca-authority",
* config: {
* subjectConfig: {
* subject: {
* organization: "HashiCorp",
* commonName: "my-certificate-authority",
* },
* subjectAltName: {
* dnsNames: ["hashicorp.com"],
* },
* },
* x509Config: {
* caOptions: {
* isCa: true,
* },
* keyUsage: {
* baseKeyUsage: {
* certSign: true,
* crlSign: true,
* },
* extendedKeyUsage: {
* serverAuth: true,
* },
* },
* },
* },
* keySpec: {
* algorithm: "RSA_PKCS1_4096_SHA256",
* },
* deletionProtection: false,
* skipGracePeriod: true,
* ignoreActiveCertificatesOnDeletion: true,
* });
* // creating certificate_issuance_config to use it in the managed certificate
* const issuanceconfig = new gcp.certificatemanager.CertificateIssuanceConfig("issuanceconfig", {
* name: "issuance-config",
* description: "sample description for the certificate issuanceConfigs",
* certificateAuthorityConfig: {
* certificateAuthorityServiceConfig: {
* caPool: pool.id,
* },
* },
* lifetime: "1814400s",
* rotationWindowPercentage: 34,
* keyAlgorithm: "ECDSA_P256",
* }, {
* dependsOn: [caAuthority],
* });
* const _default = new gcp.certificatemanager.Certificate("default", {
* name: "issuance-config-cert",
* description: "The default cert",
* scope: "EDGE_CACHE",
* managed: {
* domains: ["terraform.subdomain1.com"],
* issuanceConfig: issuanceconfig.id,
* },
* });
* ```
* ### Certificate Manager Self Managed Certificate
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as std from "@pulumi/std";
*
* const _default = new gcp.certificatemanager.Certificate("default", {
* name: "self-managed-cert",
* description: "Global cert",
* scope: "ALL_REGIONS",
* selfManaged: {
* pemCertificate: std.file({
* input: "test-fixtures/cert.pem",
* }).then(invoke => invoke.result),
* pemPrivateKey: std.file({
* input: "test-fixtures/private-key.pem",
* }).then(invoke => invoke.result),
* },
* });
* ```
* ### Certificate Manager Self Managed Certificate Regional
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as std from "@pulumi/std";
*
* const _default = new gcp.certificatemanager.Certificate("default", {
* name: "self-managed-cert",
* description: "Regional cert",
* location: "us-central1",
* selfManaged: {
* pemCertificate: std.file({
* input: "test-fixtures/cert.pem",
* }).then(invoke => invoke.result),
* pemPrivateKey: std.file({
* input: "test-fixtures/private-key.pem",
* }).then(invoke => invoke.result),
* },
* });
* ```
* ### Certificate Manager Google Managed Certificate Issuance Config All Regions
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const pool = new gcp.certificateauthority.CaPool("pool", {
* name: "ca-pool",
* location: "us-central1",
* tier: "ENTERPRISE",
* });
* const caAuthority = new gcp.certificateauthority.Authority("ca_authority", {
* location: "us-central1",
* pool: pool.name,
* certificateAuthorityId: "ca-authority",
* config: {
* subjectConfig: {
* subject: {
* organization: "HashiCorp",
* commonName: "my-certificate-authority",
* },
* subjectAltName: {
* dnsNames: ["hashicorp.com"],
* },
* },
* x509Config: {
* caOptions: {
* isCa: true,
* },
* keyUsage: {
* baseKeyUsage: {
* certSign: true,
* crlSign: true,
* },
* extendedKeyUsage: {
* serverAuth: true,
* },
* },
* },
* },
* keySpec: {
* algorithm: "RSA_PKCS1_4096_SHA256",
* },
* deletionProtection: false,
* skipGracePeriod: true,
* ignoreActiveCertificatesOnDeletion: true,
* });
* // creating certificate_issuance_config to use it in the managed certificate
* const issuanceconfig = new gcp.certificatemanager.CertificateIssuanceConfig("issuanceconfig", {
* name: "issuance-config",
* description: "sample description for the certificate issuanceConfigs",
* certificateAuthorityConfig: {
* certificateAuthorityServiceConfig: {
* caPool: pool.id,
* },
* },
* lifetime: "1814400s",
* rotationWindowPercentage: 34,
* keyAlgorithm: "ECDSA_P256",
* }, {
* dependsOn: [caAuthority],
* });
* const _default = new gcp.certificatemanager.Certificate("default", {
* name: "issuance-config-cert",
* description: "sample google managed all_regions certificate with issuance config for terraform",
* scope: "ALL_REGIONS",
* managed: {
* domains: ["terraform.subdomain1.com"],
* issuanceConfig: issuanceconfig.id,
* },
* });
* ```
* ### Certificate Manager Google Managed Certificate Dns All Regions
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const instance = new gcp.certificatemanager.DnsAuthorization("instance", {
* name: "dns-auth",
* description: "The default dnss",
* domain: "subdomain.hashicorptest.com",
* });
* const instance2 = new gcp.certificatemanager.DnsAuthorization("instance2", {
* name: "dns-auth2",
* description: "The default dnss",
* domain: "subdomain2.hashicorptest.com",
* });
* const _default = new gcp.certificatemanager.Certificate("default", {
* name: "dns-cert",
* description: "The default cert",
* scope: "ALL_REGIONS",
* managed: {
* domains: [
* instance.domain,
* instance2.domain,
* ],
* dnsAuthorizations: [
* instance.id,
* instance2.id,
* ],
* },
* });
* ```
* ### Certificate Manager Google Managed Regional Certificate Dns Auth
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const instance = new gcp.certificatemanager.DnsAuthorization("instance", {
* name: "dns-auth",
* location: "us-central1",
* description: "The default dnss",
* domain: "subdomain.hashicorptest.com",
* });
* const _default = new gcp.certificatemanager.Certificate("default", {
* name: "dns-cert",
* description: "regional managed certs",
* location: "us-central1",
* managed: {
* domains: [instance.domain],
* dnsAuthorizations: [instance.id],
* },
* });
* ```
* ### Certificate Manager Client Auth Certificate
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as std from "@pulumi/std";
*
* const _default = new gcp.certificatemanager.Certificate("default", {
* name: "client-auth-cert",
* description: "Global cert",
* scope: "CLIENT_AUTH",
* selfManaged: {
* pemCertificate: std.file({
* input: "test-fixtures/cert.pem",
* }).then(invoke => invoke.result),
* pemPrivateKey: std.file({
* input: "test-fixtures/private-key.pem",
* }).then(invoke => invoke.result),
* },
* });
* ```
*
* ## Import
*
* Certificate can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/certificates/{{name}}`
* * `{{project}}/{{location}}/{{name}}`
* * `{{location}}/{{name}}`
*
* When using the `pulumi import` command, Certificate can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:certificatemanager/certificate:Certificate default projects/{{project}}/locations/{{location}}/certificates/{{name}}
* $ pulumi import gcp:certificatemanager/certificate:Certificate default {{project}}/{{location}}/{{name}}
* $ pulumi import gcp:certificatemanager/certificate:Certificate default {{location}}/{{name}}
* ```
*/
class Certificate extends pulumi.CustomResource {
/**
* Get an existing Certificate 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 Certificate(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:certificatemanager/certificate:Certificate';
/**
* Returns true if the given object is an instance of Certificate. 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'] === Certificate.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["description"] = state?.description;
resourceInputs["effectiveLabels"] = state?.effectiveLabels;
resourceInputs["labels"] = state?.labels;
resourceInputs["location"] = state?.location;
resourceInputs["managed"] = state?.managed;
resourceInputs["name"] = state?.name;
resourceInputs["project"] = state?.project;
resourceInputs["pulumiLabels"] = state?.pulumiLabels;
resourceInputs["sanDnsnames"] = state?.sanDnsnames;
resourceInputs["scope"] = state?.scope;
resourceInputs["selfManaged"] = state?.selfManaged;
}
else {
const args = argsOrState;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["description"] = args?.description;
resourceInputs["labels"] = args?.labels;
resourceInputs["location"] = args?.location;
resourceInputs["managed"] = args?.managed;
resourceInputs["name"] = args?.name;
resourceInputs["project"] = args?.project;
resourceInputs["scope"] = args?.scope;
resourceInputs["selfManaged"] = args?.selfManaged;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["sanDnsnames"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Certificate.__pulumiType, name, resourceInputs, opts);
}
}
exports.Certificate = Certificate;
//# sourceMappingURL=certificate.js.map