@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
358 lines • 14.1 kB
JavaScript
"use strict";
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.TargetHttpsProxy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = 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}`],
* });
* ```
*
* ## 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}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/targetHttpsProxy:TargetHttpsProxy default {{project}}/{{name}}
* ```
*
* ```sh
* $ 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, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* 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 ? state.certificateManagerCertificates : undefined;
resourceInputs["certificateMap"] = state ? state.certificateMap : undefined;
resourceInputs["creationTimestamp"] = state ? state.creationTimestamp : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["httpKeepAliveTimeoutSec"] = state ? state.httpKeepAliveTimeoutSec : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["proxyBind"] = state ? state.proxyBind : undefined;
resourceInputs["proxyId"] = state ? state.proxyId : undefined;
resourceInputs["quicOverride"] = state ? state.quicOverride : undefined;
resourceInputs["selfLink"] = state ? state.selfLink : undefined;
resourceInputs["serverTlsPolicy"] = state ? state.serverTlsPolicy : undefined;
resourceInputs["sslCertificates"] = state ? state.sslCertificates : undefined;
resourceInputs["sslPolicy"] = state ? state.sslPolicy : undefined;
resourceInputs["tlsEarlyData"] = state ? state.tlsEarlyData : undefined;
resourceInputs["urlMap"] = state ? state.urlMap : undefined;
}
else {
const args = argsOrState;
if ((!args || args.urlMap === undefined) && !opts.urn) {
throw new Error("Missing required property 'urlMap'");
}
resourceInputs["certificateManagerCertificates"] = args ? args.certificateManagerCertificates : undefined;
resourceInputs["certificateMap"] = args ? args.certificateMap : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["httpKeepAliveTimeoutSec"] = args ? args.httpKeepAliveTimeoutSec : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["proxyBind"] = args ? args.proxyBind : undefined;
resourceInputs["quicOverride"] = args ? args.quicOverride : undefined;
resourceInputs["serverTlsPolicy"] = args ? args.serverTlsPolicy : undefined;
resourceInputs["sslCertificates"] = args ? args.sslCertificates : undefined;
resourceInputs["sslPolicy"] = args ? args.sslPolicy : undefined;
resourceInputs["tlsEarlyData"] = args ? args.tlsEarlyData : undefined;
resourceInputs["urlMap"] = args ? args.urlMap : undefined;
resourceInputs["creationTimestamp"] = 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;
/** @internal */
TargetHttpsProxy.__pulumiType = 'gcp:compute/targetHttpsProxy:TargetHttpsProxy';
//# sourceMappingURL=targetHttpsProxy.js.map