@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
430 lines • 16.5 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.TargetHttpsProxy = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Represents a TargetHttpsProxy resource, which is used by one or more
* global forwarding rule to route incoming HTTPS requests to a URL map.
*
* To get more information about TargetHttpsProxy, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/v1/targetHttpsProxies)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/compute/docs/load-balancing/http/target-proxies)
*
* ## Example Usage
*
* ### Target Https Proxy Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as std from "@pulumi/std";
*
* const defaultSSLCertificate = new gcp.compute.SSLCertificate("default", {
* name: "my-certificate",
* privateKey: std.file({
* input: "path/to/private.key",
* }).then(invoke => invoke.result),
* certificate: std.file({
* input: "path/to/certificate.crt",
* }).then(invoke => invoke.result),
* });
* const defaultHttpHealthCheck = new gcp.compute.HttpHealthCheck("default", {
* name: "http-health-check",
* requestPath: "/",
* checkIntervalSec: 1,
* timeoutSec: 1,
* });
* const defaultBackendService = new gcp.compute.BackendService("default", {
* name: "backend-service",
* portName: "http",
* protocol: "HTTP",
* timeoutSec: 10,
* healthChecks: defaultHttpHealthCheck.id,
* });
* const defaultURLMap = new gcp.compute.URLMap("default", {
* name: "url-map",
* description: "a description",
* defaultService: defaultBackendService.id,
* hostRules: [{
* hosts: ["mysite.com"],
* pathMatcher: "allpaths",
* }],
* pathMatchers: [{
* name: "allpaths",
* defaultService: defaultBackendService.id,
* pathRules: [{
* paths: ["/*"],
* service: defaultBackendService.id,
* }],
* }],
* });
* const _default = new gcp.compute.TargetHttpsProxy("default", {
* name: "test-proxy",
* urlMap: defaultURLMap.id,
* sslCertificates: [defaultSSLCertificate.id],
* });
* ```
* ### Target Https Proxy Http Keep Alive Timeout
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as std from "@pulumi/std";
*
* const defaultSSLCertificate = new gcp.compute.SSLCertificate("default", {
* name: "my-certificate",
* privateKey: std.file({
* input: "path/to/private.key",
* }).then(invoke => invoke.result),
* certificate: std.file({
* input: "path/to/certificate.crt",
* }).then(invoke => invoke.result),
* });
* const defaultHttpHealthCheck = new gcp.compute.HttpHealthCheck("default", {
* name: "http-health-check",
* requestPath: "/",
* checkIntervalSec: 1,
* timeoutSec: 1,
* });
* const defaultBackendService = new gcp.compute.BackendService("default", {
* name: "backend-service",
* portName: "http",
* protocol: "HTTP",
* timeoutSec: 10,
* loadBalancingScheme: "EXTERNAL_MANAGED",
* healthChecks: defaultHttpHealthCheck.id,
* });
* const defaultURLMap = new gcp.compute.URLMap("default", {
* name: "url-map",
* description: "a description",
* defaultService: defaultBackendService.id,
* hostRules: [{
* hosts: ["mysite.com"],
* pathMatcher: "allpaths",
* }],
* pathMatchers: [{
* name: "allpaths",
* defaultService: defaultBackendService.id,
* pathRules: [{
* paths: ["/*"],
* service: defaultBackendService.id,
* }],
* }],
* });
* const _default = new gcp.compute.TargetHttpsProxy("default", {
* name: "test-http-keep-alive-timeout-proxy",
* httpKeepAliveTimeoutSec: 610,
* urlMap: defaultURLMap.id,
* sslCertificates: [defaultSSLCertificate.id],
* });
* ```
* ### Target Https Proxy Mtls
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as std from "@pulumi/std";
*
* const project = gcp.organizations.getProject({});
* const defaultTrustConfig = new gcp.certificatemanager.TrustConfig("default", {
* name: "my-trust-config",
* description: "sample description for the trust config",
* location: "global",
* trustStores: [{
* trustAnchors: [{
* pemCertificate: std.file({
* input: "test-fixtures/ca_cert.pem",
* }).then(invoke => invoke.result),
* }],
* intermediateCas: [{
* pemCertificate: std.file({
* input: "test-fixtures/ca_cert.pem",
* }).then(invoke => invoke.result),
* }],
* }],
* labels: {
* foo: "bar",
* },
* });
* const defaultServerTlsPolicy = new gcp.networksecurity.ServerTlsPolicy("default", {
* name: "my-tls-policy",
* description: "my description",
* location: "global",
* allowOpen: false,
* mtlsPolicy: {
* clientValidationMode: "ALLOW_INVALID_OR_MISSING_CLIENT_CERT",
* clientValidationTrustConfig: pulumi.all([project, defaultTrustConfig.name]).apply(([project, name]) => `projects/${project.number}/locations/global/trustConfigs/${name}`),
* },
* });
* const defaultSSLCertificate = new gcp.compute.SSLCertificate("default", {
* name: "my-certificate",
* privateKey: std.file({
* input: "path/to/private.key",
* }).then(invoke => invoke.result),
* certificate: std.file({
* input: "path/to/certificate.crt",
* }).then(invoke => invoke.result),
* });
* const defaultHttpHealthCheck = new gcp.compute.HttpHealthCheck("default", {
* name: "http-health-check",
* requestPath: "/",
* checkIntervalSec: 1,
* timeoutSec: 1,
* });
* const defaultBackendService = new gcp.compute.BackendService("default", {
* name: "backend-service",
* portName: "http",
* protocol: "HTTP",
* timeoutSec: 10,
* healthChecks: defaultHttpHealthCheck.id,
* });
* const defaultURLMap = new gcp.compute.URLMap("default", {
* name: "url-map",
* description: "a description",
* defaultService: defaultBackendService.id,
* hostRules: [{
* hosts: ["mysite.com"],
* pathMatcher: "allpaths",
* }],
* pathMatchers: [{
* name: "allpaths",
* defaultService: defaultBackendService.id,
* pathRules: [{
* paths: ["/*"],
* service: defaultBackendService.id,
* }],
* }],
* });
* const _default = new gcp.compute.TargetHttpsProxy("default", {
* name: "test-mtls-proxy",
* urlMap: defaultURLMap.id,
* sslCertificates: [defaultSSLCertificate.id],
* serverTlsPolicy: defaultServerTlsPolicy.id,
* });
* ```
* ### Target Https Proxy Certificate Manager Certificate
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as std from "@pulumi/std";
*
* const defaultCertificate = new gcp.certificatemanager.Certificate("default", {
* name: "my-certificate",
* 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),
* },
* });
* const defaultBackendService = new gcp.compute.BackendService("default", {
* name: "backend-service",
* portName: "http",
* protocol: "HTTP",
* timeoutSec: 10,
* loadBalancingScheme: "INTERNAL_MANAGED",
* });
* const defaultURLMap = new gcp.compute.URLMap("default", {
* name: "url-map",
* description: "a description",
* defaultService: defaultBackendService.id,
* hostRules: [{
* hosts: ["mysite.com"],
* pathMatcher: "allpaths",
* }],
* pathMatchers: [{
* name: "allpaths",
* defaultService: defaultBackendService.id,
* pathRules: [{
* paths: ["/*"],
* service: defaultBackendService.id,
* }],
* }],
* });
* const _default = new gcp.compute.TargetHttpsProxy("default", {
* name: "target-http-proxy",
* urlMap: defaultURLMap.id,
* certificateManagerCertificates: [pulumi.interpolate`//certificatemanager.googleapis.com/${defaultCertificate.id}`],
* });
* ```
* ### Target Https Proxy Fingerprint
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as std from "@pulumi/std";
*
* const defaultSSLCertificate = new gcp.compute.SSLCertificate("default", {
* name: "my-certificate",
* privateKey: std.file({
* input: "path/to/private.key",
* }).then(invoke => invoke.result),
* certificate: std.file({
* input: "path/to/certificate.crt",
* }).then(invoke => invoke.result),
* });
* const defaultHttpHealthCheck = new gcp.compute.HttpHealthCheck("default", {
* name: "http-health-check",
* requestPath: "/",
* checkIntervalSec: 1,
* timeoutSec: 1,
* });
* const defaultBackendService = new gcp.compute.BackendService("default", {
* name: "backend-service",
* portName: "http",
* protocol: "HTTP",
* timeoutSec: 10,
* healthChecks: defaultHttpHealthCheck.id,
* });
* const defaultURLMap = new gcp.compute.URLMap("default", {
* name: "url-map",
* description: "a description",
* defaultService: defaultBackendService.id,
* hostRules: [{
* hosts: ["mysite.com"],
* pathMatcher: "allpaths",
* }],
* pathMatchers: [{
* name: "allpaths",
* defaultService: defaultBackendService.id,
* pathRules: [{
* paths: ["/*"],
* service: defaultBackendService.id,
* }],
* }],
* });
* const _default = new gcp.compute.TargetHttpsProxy("default", {
* name: "test-fingerprint-proxy",
* urlMap: defaultURLMap.id,
* sslCertificates: [defaultSSLCertificate.id],
* });
* export const targetHttpsProxyFingerprint = _default.fingerprint;
* ```
*
* ## Import
*
* TargetHttpsProxy can be imported using any of these accepted formats:
*
* * `projects/{{project}}/global/targetHttpsProxies/{{name}}`
* * `{{project}}/{{name}}`
* * `{{name}}`
*
* When using the `pulumi import` command, TargetHttpsProxy can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/targetHttpsProxy:TargetHttpsProxy default projects/{{project}}/global/targetHttpsProxies/{{name}}
* $ pulumi import gcp:compute/targetHttpsProxy:TargetHttpsProxy default {{project}}/{{name}}
* $ pulumi import gcp:compute/targetHttpsProxy:TargetHttpsProxy default {{name}}
* ```
*/
class TargetHttpsProxy extends pulumi.CustomResource {
/**
* Get an existing TargetHttpsProxy 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 TargetHttpsProxy(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:compute/targetHttpsProxy:TargetHttpsProxy';
/**
* Returns true if the given object is an instance of TargetHttpsProxy. 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'] === TargetHttpsProxy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["certificateManagerCertificates"] = state?.certificateManagerCertificates;
resourceInputs["certificateMap"] = state?.certificateMap;
resourceInputs["creationTimestamp"] = state?.creationTimestamp;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["description"] = state?.description;
resourceInputs["fingerprint"] = state?.fingerprint;
resourceInputs["httpKeepAliveTimeoutSec"] = state?.httpKeepAliveTimeoutSec;
resourceInputs["name"] = state?.name;
resourceInputs["project"] = state?.project;
resourceInputs["proxyBind"] = state?.proxyBind;
resourceInputs["proxyId"] = state?.proxyId;
resourceInputs["quicOverride"] = state?.quicOverride;
resourceInputs["selfLink"] = state?.selfLink;
resourceInputs["serverTlsPolicy"] = state?.serverTlsPolicy;
resourceInputs["sslCertificates"] = state?.sslCertificates;
resourceInputs["sslPolicy"] = state?.sslPolicy;
resourceInputs["tlsEarlyData"] = state?.tlsEarlyData;
resourceInputs["urlMap"] = state?.urlMap;
}
else {
const args = argsOrState;
if (args?.urlMap === undefined && !opts.urn) {
throw new Error("Missing required property 'urlMap'");
}
resourceInputs["certificateManagerCertificates"] = args?.certificateManagerCertificates;
resourceInputs["certificateMap"] = args?.certificateMap;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["description"] = args?.description;
resourceInputs["httpKeepAliveTimeoutSec"] = args?.httpKeepAliveTimeoutSec;
resourceInputs["name"] = args?.name;
resourceInputs["project"] = args?.project;
resourceInputs["proxyBind"] = args?.proxyBind;
resourceInputs["quicOverride"] = args?.quicOverride;
resourceInputs["serverTlsPolicy"] = args?.serverTlsPolicy;
resourceInputs["sslCertificates"] = args?.sslCertificates;
resourceInputs["sslPolicy"] = args?.sslPolicy;
resourceInputs["tlsEarlyData"] = args?.tlsEarlyData;
resourceInputs["urlMap"] = args?.urlMap;
resourceInputs["creationTimestamp"] = undefined /*out*/;
resourceInputs["fingerprint"] = undefined /*out*/;
resourceInputs["proxyId"] = undefined /*out*/;
resourceInputs["selfLink"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(TargetHttpsProxy.__pulumiType, name, resourceInputs, opts);
}
}
exports.TargetHttpsProxy = TargetHttpsProxy;
//# sourceMappingURL=targetHttpsProxy.js.map