@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
454 lines (453 loc) • 16 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* Service is a network/api interface that exposes some functionality to clients for consumption over the network. Service typically has one or more Workloads behind it. It registers identified service to the Application.
*
* ## Example Usage
*
* ### Apphub Service Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as time from "@pulumi/time";
*
* const application = new gcp.apphub.Application("application", {
* location: "us-central1",
* applicationId: "example-application-1",
* scope: {
* type: "REGIONAL",
* },
* });
* const serviceProject = new gcp.organizations.Project("service_project", {
* projectId: "project-1",
* name: "Service Project",
* orgId: "123456789",
* billingAccount: "000000-0000000-0000000-000000",
* deletionPolicy: "DELETE",
* });
* // Enable Compute API
* const computeServiceProject = new gcp.projects.Service("compute_service_project", {
* project: serviceProject.projectId,
* service: "compute.googleapis.com",
* });
* const wait120s = new time.index.Sleep("wait_120s", {createDuration: "120s"}, {
* dependsOn: [computeServiceProject],
* });
* const serviceProjectAttachment = new gcp.apphub.ServiceProjectAttachment("service_project_attachment", {serviceProjectAttachmentId: serviceProject.projectId}, {
* dependsOn: [wait120s],
* });
* // VPC network
* const ilbNetwork = new gcp.compute.Network("ilb_network", {
* name: "l7-ilb-network",
* project: serviceProject.projectId,
* autoCreateSubnetworks: false,
* }, {
* dependsOn: [wait120s],
* });
* // backend subnet
* const ilbSubnet = new gcp.compute.Subnetwork("ilb_subnet", {
* name: "l7-ilb-subnet",
* project: serviceProject.projectId,
* ipCidrRange: "10.0.1.0/24",
* region: "us-central1",
* network: ilbNetwork.id,
* });
* // health check
* const _default = new gcp.compute.HealthCheck("default", {
* name: "l7-ilb-hc",
* project: serviceProject.projectId,
* checkIntervalSec: 1,
* timeoutSec: 1,
* tcpHealthCheck: {
* port: 80,
* },
* }, {
* dependsOn: [wait120s],
* });
* // backend service
* const backend = new gcp.compute.RegionBackendService("backend", {
* name: "l7-ilb-backend-subnet",
* project: serviceProject.projectId,
* region: "us-central1",
* healthChecks: _default.id,
* });
* // forwarding rule
* const forwardingRule = new gcp.compute.ForwardingRule("forwarding_rule", {
* name: "l7-ilb-forwarding-rule",
* project: serviceProject.projectId,
* region: "us-central1",
* ipVersion: "IPV4",
* loadBalancingScheme: "INTERNAL",
* allPorts: true,
* backendService: backend.id,
* network: ilbNetwork.id,
* subnetwork: ilbSubnet.id,
* });
* // discovered service block
* const catalog_service = gcp.apphub.getDiscoveredServiceOutput({
* location: "us-central1",
* serviceUri: pulumi.interpolate`//compute.googleapis.com/${forwardingRule.id}`,
* });
* const wait120sForResourceIngestion = new time.index.Sleep("wait_120s_for_resource_ingestion", {createDuration: "120s"}, {
* dependsOn: [forwardingRule],
* });
* const example = new gcp.apphub.Service("example", {
* location: "us-central1",
* applicationId: application.applicationId,
* serviceId: forwardingRule.name,
* discoveredService: catalog_service.apply(catalog_service => catalog_service.name),
* });
* ```
* ### Apphub Service Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as time from "@pulumi/time";
*
* const application = new gcp.apphub.Application("application", {
* location: "us-central1",
* applicationId: "example-application-1",
* scope: {
* type: "REGIONAL",
* },
* });
* const serviceProject = new gcp.organizations.Project("service_project", {
* projectId: "project-1",
* name: "Service Project",
* orgId: "123456789",
* billingAccount: "000000-0000000-0000000-000000",
* deletionPolicy: "DELETE",
* });
* // Enable Compute API
* const computeServiceProject = new gcp.projects.Service("compute_service_project", {
* project: serviceProject.projectId,
* service: "compute.googleapis.com",
* });
* const wait120s = new time.index.Sleep("wait_120s", {createDuration: "120s"}, {
* dependsOn: [computeServiceProject],
* });
* const serviceProjectAttachment = new gcp.apphub.ServiceProjectAttachment("service_project_attachment", {serviceProjectAttachmentId: serviceProject.projectId}, {
* dependsOn: [wait120s],
* });
* // VPC network
* const ilbNetwork = new gcp.compute.Network("ilb_network", {
* name: "l7-ilb-network",
* project: serviceProject.projectId,
* autoCreateSubnetworks: false,
* }, {
* dependsOn: [wait120s],
* });
* // backend subnet
* const ilbSubnet = new gcp.compute.Subnetwork("ilb_subnet", {
* name: "l7-ilb-subnet",
* project: serviceProject.projectId,
* ipCidrRange: "10.0.1.0/24",
* region: "us-central1",
* network: ilbNetwork.id,
* });
* // health check
* const _default = new gcp.compute.HealthCheck("default", {
* name: "l7-ilb-hc",
* project: serviceProject.projectId,
* checkIntervalSec: 1,
* timeoutSec: 1,
* tcpHealthCheck: {
* port: 80,
* },
* }, {
* dependsOn: [wait120s],
* });
* // backend service
* const backend = new gcp.compute.RegionBackendService("backend", {
* name: "l7-ilb-backend-subnet",
* project: serviceProject.projectId,
* region: "us-central1",
* healthChecks: _default.id,
* });
* // forwarding rule
* const forwardingRule = new gcp.compute.ForwardingRule("forwarding_rule", {
* name: "l7-ilb-forwarding-rule",
* project: serviceProject.projectId,
* region: "us-central1",
* ipVersion: "IPV4",
* loadBalancingScheme: "INTERNAL",
* allPorts: true,
* backendService: backend.id,
* network: ilbNetwork.id,
* subnetwork: ilbSubnet.id,
* });
* // discovered service block
* const catalog_service = gcp.apphub.getDiscoveredServiceOutput({
* location: "us-central1",
* serviceUri: pulumi.interpolate`//compute.googleapis.com/${forwardingRule.id}`,
* });
* const wait120sForResourceIngestion = new time.index.Sleep("wait_120s_for_resource_ingestion", {createDuration: "120s"}, {
* dependsOn: [forwardingRule],
* });
* const example = new gcp.apphub.Service("example", {
* location: "us-central1",
* applicationId: application.applicationId,
* serviceId: forwardingRule.name,
* discoveredService: catalog_service.apply(catalog_service => catalog_service.name),
* displayName: "Example Service Full",
* description: "Register service for testing",
* attributes: {
* environment: {
* type: "STAGING",
* },
* criticality: {
* type: "MISSION_CRITICAL",
* },
* businessOwners: [{
* displayName: "Alice",
* email: "alice@google.com",
* }],
* developerOwners: [{
* displayName: "Bob",
* email: "bob@google.com",
* }],
* operatorOwners: [{
* displayName: "Charlie",
* email: "charlie@google.com",
* }],
* },
* });
* ```
*
* ## Import
*
* Service can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/applications/{{application_id}}/services/{{service_id}}`
*
* * `{{project}}/{{location}}/{{application_id}}/{{service_id}}`
*
* * `{{location}}/{{application_id}}/{{service_id}}`
*
* When using the `pulumi import` command, Service can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:apphub/service:Service default projects/{{project}}/locations/{{location}}/applications/{{application_id}}/services/{{service_id}}
* ```
*
* ```sh
* $ pulumi import gcp:apphub/service:Service default {{project}}/{{location}}/{{application_id}}/{{service_id}}
* ```
*
* ```sh
* $ pulumi import gcp:apphub/service:Service default {{location}}/{{application_id}}/{{service_id}}
* ```
*/
export declare class Service extends pulumi.CustomResource {
/**
* Get an existing Service 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: string, id: pulumi.Input<pulumi.ID>, state?: ServiceState, opts?: pulumi.CustomResourceOptions): Service;
/**
* Returns true if the given object is an instance of Service. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is Service;
/**
* Part of `parent`. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
*/
readonly applicationId: pulumi.Output<string>;
/**
* Consumer provided attributes.
* Structure is documented below.
*/
readonly attributes: pulumi.Output<outputs.apphub.ServiceAttributes | undefined>;
/**
* Output only. Create time.
*/
readonly createTime: pulumi.Output<string>;
/**
* User-defined description of a Service.
*/
readonly description: pulumi.Output<string | undefined>;
/**
* Immutable. The resource name of the original discovered service.
*/
readonly discoveredService: pulumi.Output<string>;
/**
* User-defined name for the Service.
*/
readonly displayName: pulumi.Output<string | undefined>;
/**
* Part of `parent`. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
*/
readonly location: pulumi.Output<string>;
/**
* Identifier. The resource name of a Service. Format:
* "projects/{host-project-id}/locations/{location}/applications/{application-id}/services/{service-id}"
*/
readonly name: pulumi.Output<string>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
readonly project: pulumi.Output<string>;
/**
* The Service identifier.
*
*
* - - -
*/
readonly serviceId: pulumi.Output<string>;
/**
* Properties of an underlying cloud resource that can comprise a Service.
* Structure is documented below.
*/
readonly serviceProperties: pulumi.Output<outputs.apphub.ServiceServiceProperty[]>;
/**
* Reference to an underlying networking resource that can comprise a Service.
* Structure is documented below.
*/
readonly serviceReferences: pulumi.Output<outputs.apphub.ServiceServiceReference[]>;
/**
* Output only. Service state. Possible values: STATE_UNSPECIFIED CREATING ACTIVE DELETING DETACHED
*/
readonly state: pulumi.Output<string>;
/**
* Output only. A universally unique identifier (UUID) for the `Service` in the UUID4
* format.
*/
readonly uid: pulumi.Output<string>;
/**
* Output only. Update time.
*/
readonly updateTime: pulumi.Output<string>;
/**
* Create a Service resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: ServiceArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Service resources.
*/
export interface ServiceState {
/**
* Part of `parent`. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
*/
applicationId?: pulumi.Input<string>;
/**
* Consumer provided attributes.
* Structure is documented below.
*/
attributes?: pulumi.Input<inputs.apphub.ServiceAttributes>;
/**
* Output only. Create time.
*/
createTime?: pulumi.Input<string>;
/**
* User-defined description of a Service.
*/
description?: pulumi.Input<string>;
/**
* Immutable. The resource name of the original discovered service.
*/
discoveredService?: pulumi.Input<string>;
/**
* User-defined name for the Service.
*/
displayName?: pulumi.Input<string>;
/**
* Part of `parent`. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
*/
location?: pulumi.Input<string>;
/**
* Identifier. The resource name of a Service. Format:
* "projects/{host-project-id}/locations/{location}/applications/{application-id}/services/{service-id}"
*/
name?: pulumi.Input<string>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string>;
/**
* The Service identifier.
*
*
* - - -
*/
serviceId?: pulumi.Input<string>;
/**
* Properties of an underlying cloud resource that can comprise a Service.
* Structure is documented below.
*/
serviceProperties?: pulumi.Input<pulumi.Input<inputs.apphub.ServiceServiceProperty>[]>;
/**
* Reference to an underlying networking resource that can comprise a Service.
* Structure is documented below.
*/
serviceReferences?: pulumi.Input<pulumi.Input<inputs.apphub.ServiceServiceReference>[]>;
/**
* Output only. Service state. Possible values: STATE_UNSPECIFIED CREATING ACTIVE DELETING DETACHED
*/
state?: pulumi.Input<string>;
/**
* Output only. A universally unique identifier (UUID) for the `Service` in the UUID4
* format.
*/
uid?: pulumi.Input<string>;
/**
* Output only. Update time.
*/
updateTime?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a Service resource.
*/
export interface ServiceArgs {
/**
* Part of `parent`. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
*/
applicationId: pulumi.Input<string>;
/**
* Consumer provided attributes.
* Structure is documented below.
*/
attributes?: pulumi.Input<inputs.apphub.ServiceAttributes>;
/**
* User-defined description of a Service.
*/
description?: pulumi.Input<string>;
/**
* Immutable. The resource name of the original discovered service.
*/
discoveredService: pulumi.Input<string>;
/**
* User-defined name for the Service.
*/
displayName?: pulumi.Input<string>;
/**
* Part of `parent`. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
*/
location: pulumi.Input<string>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string>;
/**
* The Service identifier.
*
*
* - - -
*/
serviceId: pulumi.Input<string>;
}