All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.gcp.apphub.kotlin.Service.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.apphub.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.apphub.kotlin.outputs.ServiceAttributes
import com.pulumi.gcp.apphub.kotlin.outputs.ServiceServiceProperty
import com.pulumi.gcp.apphub.kotlin.outputs.ServiceServiceReference
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.gcp.apphub.kotlin.outputs.ServiceAttributes.Companion.toKotlin as serviceAttributesToKotlin
import com.pulumi.gcp.apphub.kotlin.outputs.ServiceServiceProperty.Companion.toKotlin as serviceServicePropertyToKotlin
import com.pulumi.gcp.apphub.kotlin.outputs.ServiceServiceReference.Companion.toKotlin as serviceServiceReferenceToKotlin

/**
 * Builder for [Service].
 */
@PulumiTagMarker
public class ServiceResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ServiceArgs = ServiceArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend ServiceArgsBuilder.() -> Unit) {
        val builder = ServiceArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): Service {
        val builtJavaResource = com.pulumi.gcp.apphub.Service(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Service(builtJavaResource)
    }
}

/**
 * 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",
 * });
 * // 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),
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * import pulumi_time as time
 * application = gcp.apphub.Application("application",
 *     location="us-central1",
 *     application_id="example-application-1",
 *     scope={
 *         "type": "REGIONAL",
 *     })
 * service_project = gcp.organizations.Project("service_project",
 *     project_id="project-1",
 *     name="Service Project",
 *     org_id="123456789",
 *     billing_account="000000-0000000-0000000-000000")
 * # Enable Compute API
 * compute_service_project = gcp.projects.Service("compute_service_project",
 *     project=service_project.project_id,
 *     service="compute.googleapis.com")
 * wait120s = time.index.Sleep("wait_120s", create_duration=120s,
 * opts = pulumi.ResourceOptions(depends_on=[compute_service_project]))
 * service_project_attachment = gcp.apphub.ServiceProjectAttachment("service_project_attachment", service_project_attachment_id=service_project.project_id,
 * opts = pulumi.ResourceOptions(depends_on=[wait120s]))
 * # VPC network
 * ilb_network = gcp.compute.Network("ilb_network",
 *     name="l7-ilb-network",
 *     project=service_project.project_id,
 *     auto_create_subnetworks=False,
 *     opts = pulumi.ResourceOptions(depends_on=[wait120s]))
 * # backend subnet
 * ilb_subnet = gcp.compute.Subnetwork("ilb_subnet",
 *     name="l7-ilb-subnet",
 *     project=service_project.project_id,
 *     ip_cidr_range="10.0.1.0/24",
 *     region="us-central1",
 *     network=ilb_network.id)
 * # health check
 * default = gcp.compute.HealthCheck("default",
 *     name="l7-ilb-hc",
 *     project=service_project.project_id,
 *     check_interval_sec=1,
 *     timeout_sec=1,
 *     tcp_health_check={
 *         "port": 80,
 *     },
 *     opts = pulumi.ResourceOptions(depends_on=[wait120s]))
 * # backend service
 * backend = gcp.compute.RegionBackendService("backend",
 *     name="l7-ilb-backend-subnet",
 *     project=service_project.project_id,
 *     region="us-central1",
 *     health_checks=default.id)
 * # forwarding rule
 * forwarding_rule = gcp.compute.ForwardingRule("forwarding_rule",
 *     name="l7-ilb-forwarding-rule",
 *     project=service_project.project_id,
 *     region="us-central1",
 *     ip_version="IPV4",
 *     load_balancing_scheme="INTERNAL",
 *     all_ports=True,
 *     backend_service=backend.id,
 *     network=ilb_network.id,
 *     subnetwork=ilb_subnet.id)
 * # discovered service block
 * catalog_service = gcp.apphub.get_discovered_service_output(location="us-central1",
 *     service_uri=forwarding_rule.id.apply(lambda id: f"//compute.googleapis.com/{id}"))
 * wait120s_for_resource_ingestion = time.index.Sleep("wait_120s_for_resource_ingestion", create_duration=120s,
 * opts = pulumi.ResourceOptions(depends_on=[forwarding_rule]))
 * example = gcp.apphub.Service("example",
 *     location="us-central1",
 *     application_id=application.application_id,
 *     service_id=forwarding_rule.name,
 *     discovered_service=catalog_service.name)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * using Time = Pulumi.Time;
 * return await Deployment.RunAsync(() =>
 * {
 *     var application = new Gcp.Apphub.Application("application", new()
 *     {
 *         Location = "us-central1",
 *         ApplicationId = "example-application-1",
 *         Scope = new Gcp.Apphub.Inputs.ApplicationScopeArgs
 *         {
 *             Type = "REGIONAL",
 *         },
 *     });
 *     var serviceProject = new Gcp.Organizations.Project("service_project", new()
 *     {
 *         ProjectId = "project-1",
 *         Name = "Service Project",
 *         OrgId = "123456789",
 *         BillingAccount = "000000-0000000-0000000-000000",
 *     });
 *     // Enable Compute API
 *     var computeServiceProject = new Gcp.Projects.Service("compute_service_project", new()
 *     {
 *         Project = serviceProject.ProjectId,
 *         ServiceName = "compute.googleapis.com",
 *     });
 *     var wait120s = new Time.Index.Sleep("wait_120s", new()
 *     {
 *         CreateDuration = "120s",
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             computeServiceProject,
 *         },
 *     });
 *     var serviceProjectAttachment = new Gcp.Apphub.ServiceProjectAttachment("service_project_attachment", new()
 *     {
 *         ServiceProjectAttachmentId = serviceProject.ProjectId,
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             wait120s,
 *         },
 *     });
 *     // VPC network
 *     var ilbNetwork = new Gcp.Compute.Network("ilb_network", new()
 *     {
 *         Name = "l7-ilb-network",
 *         Project = serviceProject.ProjectId,
 *         AutoCreateSubnetworks = false,
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             wait120s,
 *         },
 *     });
 *     // backend subnet
 *     var ilbSubnet = new Gcp.Compute.Subnetwork("ilb_subnet", new()
 *     {
 *         Name = "l7-ilb-subnet",
 *         Project = serviceProject.ProjectId,
 *         IpCidrRange = "10.0.1.0/24",
 *         Region = "us-central1",
 *         Network = ilbNetwork.Id,
 *     });
 *     // health check
 *     var @default = new Gcp.Compute.HealthCheck("default", new()
 *     {
 *         Name = "l7-ilb-hc",
 *         Project = serviceProject.ProjectId,
 *         CheckIntervalSec = 1,
 *         TimeoutSec = 1,
 *         TcpHealthCheck = new Gcp.Compute.Inputs.HealthCheckTcpHealthCheckArgs
 *         {
 *             Port = 80,
 *         },
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             wait120s,
 *         },
 *     });
 *     // backend service
 *     var backend = new Gcp.Compute.RegionBackendService("backend", new()
 *     {
 *         Name = "l7-ilb-backend-subnet",
 *         Project = serviceProject.ProjectId,
 *         Region = "us-central1",
 *         HealthChecks = @default.Id,
 *     });
 *     // forwarding rule
 *     var forwardingRule = new Gcp.Compute.ForwardingRule("forwarding_rule", new()
 *     {
 *         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
 *     var catalog_service = Gcp.Apphub.GetDiscoveredService.Invoke(new()
 *     {
 *         Location = "us-central1",
 *         ServiceUri = $"//compute.googleapis.com/{forwardingRule.Id}",
 *     });
 *     var wait120sForResourceIngestion = new Time.Index.Sleep("wait_120s_for_resource_ingestion", new()
 *     {
 *         CreateDuration = "120s",
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             forwardingRule,
 *         },
 *     });
 *     var example = new Gcp.Apphub.Service("example", new()
 *     {
 *         Location = "us-central1",
 *         ApplicationId = application.ApplicationId,
 *         ServiceId = forwardingRule.Name,
 *         DiscoveredService = catalog_service.Apply(catalog_service => catalog_service.Apply(getDiscoveredServiceResult => getDiscoveredServiceResult.Name)),
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/apphub"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
 * 	"github.com/pulumi/pulumi-time/sdk/go/time"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		application, err := apphub.NewApplication(ctx, "application", &apphub.ApplicationArgs{
 * 			Location:      pulumi.String("us-central1"),
 * 			ApplicationId: pulumi.String("example-application-1"),
 * 			Scope: &apphub.ApplicationScopeArgs{
 * 				Type: pulumi.String("REGIONAL"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		serviceProject, err := organizations.NewProject(ctx, "service_project", &organizations.ProjectArgs{
 * 			ProjectId:      pulumi.String("project-1"),
 * 			Name:           pulumi.String("Service Project"),
 * 			OrgId:          pulumi.String("123456789"),
 * 			BillingAccount: pulumi.String("000000-0000000-0000000-000000"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// Enable Compute API
 * 		computeServiceProject, err := projects.NewService(ctx, "compute_service_project", &projects.ServiceArgs{
 * 			Project: serviceProject.ProjectId,
 * 			Service: pulumi.String("compute.googleapis.com"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		wait120s, err := time.NewSleep(ctx, "wait_120s", &time.SleepArgs{
 * 			CreateDuration: "120s",
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			computeServiceProject,
 * 		}))
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = apphub.NewServiceProjectAttachment(ctx, "service_project_attachment", &apphub.ServiceProjectAttachmentArgs{
 * 			ServiceProjectAttachmentId: serviceProject.ProjectId,
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			wait120s,
 * 		}))
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// VPC network
 * 		ilbNetwork, err := compute.NewNetwork(ctx, "ilb_network", &compute.NetworkArgs{
 * 			Name:                  pulumi.String("l7-ilb-network"),
 * 			Project:               serviceProject.ProjectId,
 * 			AutoCreateSubnetworks: pulumi.Bool(false),
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			wait120s,
 * 		}))
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// backend subnet
 * 		ilbSubnet, err := compute.NewSubnetwork(ctx, "ilb_subnet", &compute.SubnetworkArgs{
 * 			Name:        pulumi.String("l7-ilb-subnet"),
 * 			Project:     serviceProject.ProjectId,
 * 			IpCidrRange: pulumi.String("10.0.1.0/24"),
 * 			Region:      pulumi.String("us-central1"),
 * 			Network:     ilbNetwork.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// health check
 * 		_, err = compute.NewHealthCheck(ctx, "default", &compute.HealthCheckArgs{
 * 			Name:             pulumi.String("l7-ilb-hc"),
 * 			Project:          serviceProject.ProjectId,
 * 			CheckIntervalSec: pulumi.Int(1),
 * 			TimeoutSec:       pulumi.Int(1),
 * 			TcpHealthCheck: &compute.HealthCheckTcpHealthCheckArgs{
 * 				Port: pulumi.Int(80),
 * 			},
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			wait120s,
 * 		}))
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// backend service
 * 		backend, err := compute.NewRegionBackendService(ctx, "backend", &compute.RegionBackendServiceArgs{
 * 			Name:         pulumi.String("l7-ilb-backend-subnet"),
 * 			Project:      serviceProject.ProjectId,
 * 			Region:       pulumi.String("us-central1"),
 * 			HealthChecks: _default.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// forwarding rule
 * 		forwardingRule, err := compute.NewForwardingRule(ctx, "forwarding_rule", &compute.ForwardingRuleArgs{
 * 			Name:                pulumi.String("l7-ilb-forwarding-rule"),
 * 			Project:             serviceProject.ProjectId,
 * 			Region:              pulumi.String("us-central1"),
 * 			IpVersion:           pulumi.String("IPV4"),
 * 			LoadBalancingScheme: pulumi.String("INTERNAL"),
 * 			AllPorts:            pulumi.Bool(true),
 * 			BackendService:      backend.ID(),
 * 			Network:             ilbNetwork.ID(),
 * 			Subnetwork:          ilbSubnet.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// discovered service block
 * 		catalog_service := apphub.GetDiscoveredServiceOutput(ctx, apphub.GetDiscoveredServiceOutputArgs{
 * 			Location: pulumi.String("us-central1"),
 * 			ServiceUri: forwardingRule.ID().ApplyT(func(id string) (string, error) {
 * 				return fmt.Sprintf("//compute.googleapis.com/%v", id), nil
 * 			}).(pulumi.StringOutput),
 * 		}, nil)
 * 		_, err = time.NewSleep(ctx, "wait_120s_for_resource_ingestion", &time.SleepArgs{
 * 			CreateDuration: "120s",
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			forwardingRule,
 * 		}))
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = apphub.NewService(ctx, "example", &apphub.ServiceArgs{
 * 			Location:      pulumi.String("us-central1"),
 * 			ApplicationId: application.ApplicationId,
 * 			ServiceId:     forwardingRule.Name,
 * 			DiscoveredService: pulumi.String(catalog_service.ApplyT(func(catalog_service apphub.GetDiscoveredServiceResult) (*string, error) {
 * 				return &catalog_service.Name, nil
 * 			}).(pulumi.StringPtrOutput)),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.apphub.Application;
 * import com.pulumi.gcp.apphub.ApplicationArgs;
 * import com.pulumi.gcp.apphub.inputs.ApplicationScopeArgs;
 * import com.pulumi.gcp.organizations.Project;
 * import com.pulumi.gcp.organizations.ProjectArgs;
 * import com.pulumi.gcp.projects.Service;
 * import com.pulumi.gcp.projects.ServiceArgs;
 * import com.pulumi.time.sleep;
 * import com.pulumi.time.SleepArgs;
 * import com.pulumi.gcp.apphub.ServiceProjectAttachment;
 * import com.pulumi.gcp.apphub.ServiceProjectAttachmentArgs;
 * import com.pulumi.gcp.compute.Network;
 * import com.pulumi.gcp.compute.NetworkArgs;
 * import com.pulumi.gcp.compute.Subnetwork;
 * import com.pulumi.gcp.compute.SubnetworkArgs;
 * import com.pulumi.gcp.compute.HealthCheck;
 * import com.pulumi.gcp.compute.HealthCheckArgs;
 * import com.pulumi.gcp.compute.inputs.HealthCheckTcpHealthCheckArgs;
 * import com.pulumi.gcp.compute.RegionBackendService;
 * import com.pulumi.gcp.compute.RegionBackendServiceArgs;
 * import com.pulumi.gcp.compute.ForwardingRule;
 * import com.pulumi.gcp.compute.ForwardingRuleArgs;
 * import com.pulumi.gcp.apphub.ApphubFunctions;
 * import com.pulumi.gcp.apphub.inputs.GetDiscoveredServiceArgs;
 * import com.pulumi.gcp.apphub.Service;
 * import com.pulumi.gcp.apphub.ServiceArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var application = new Application("application", ApplicationArgs.builder()
 *             .location("us-central1")
 *             .applicationId("example-application-1")
 *             .scope(ApplicationScopeArgs.builder()
 *                 .type("REGIONAL")
 *                 .build())
 *             .build());
 *         var serviceProject = new Project("serviceProject", ProjectArgs.builder()
 *             .projectId("project-1")
 *             .name("Service Project")
 *             .orgId("123456789")
 *             .billingAccount("000000-0000000-0000000-000000")
 *             .build());
 *         // Enable Compute API
 *         var computeServiceProject = new Service("computeServiceProject", ServiceArgs.builder()
 *             .project(serviceProject.projectId())
 *             .service("compute.googleapis.com")
 *             .build());
 *         var wait120s = new Sleep("wait120s", SleepArgs.builder()
 *             .createDuration("120s")
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(computeServiceProject)
 *                 .build());
 *         var serviceProjectAttachment = new ServiceProjectAttachment("serviceProjectAttachment", ServiceProjectAttachmentArgs.builder()
 *             .serviceProjectAttachmentId(serviceProject.projectId())
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(wait120s)
 *                 .build());
 *         // VPC network
 *         var ilbNetwork = new Network("ilbNetwork", NetworkArgs.builder()
 *             .name("l7-ilb-network")
 *             .project(serviceProject.projectId())
 *             .autoCreateSubnetworks(false)
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(wait120s)
 *                 .build());
 *         // backend subnet
 *         var ilbSubnet = new Subnetwork("ilbSubnet", SubnetworkArgs.builder()
 *             .name("l7-ilb-subnet")
 *             .project(serviceProject.projectId())
 *             .ipCidrRange("10.0.1.0/24")
 *             .region("us-central1")
 *             .network(ilbNetwork.id())
 *             .build());
 *         // health check
 *         var default_ = new HealthCheck("default", HealthCheckArgs.builder()
 *             .name("l7-ilb-hc")
 *             .project(serviceProject.projectId())
 *             .checkIntervalSec(1)
 *             .timeoutSec(1)
 *             .tcpHealthCheck(HealthCheckTcpHealthCheckArgs.builder()
 *                 .port("80")
 *                 .build())
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(wait120s)
 *                 .build());
 *         // backend service
 *         var backend = new RegionBackendService("backend", RegionBackendServiceArgs.builder()
 *             .name("l7-ilb-backend-subnet")
 *             .project(serviceProject.projectId())
 *             .region("us-central1")
 *             .healthChecks(default_.id())
 *             .build());
 *         // forwarding rule
 *         var forwardingRule = new ForwardingRule("forwardingRule", ForwardingRuleArgs.builder()
 *             .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())
 *             .build());
 *         // discovered service block
 *         final var catalog-service = ApphubFunctions.getDiscoveredService(GetDiscoveredServiceArgs.builder()
 *             .location("us-central1")
 *             .serviceUri(forwardingRule.id().applyValue(id -> String.format("//compute.googleapis.com/%s", id)))
 *             .build());
 *         var wait120sForResourceIngestion = new Sleep("wait120sForResourceIngestion", SleepArgs.builder()
 *             .createDuration("120s")
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(forwardingRule)
 *                 .build());
 *         var example = new Service("example", ServiceArgs.builder()
 *             .location("us-central1")
 *             .applicationId(application.applicationId())
 *             .serviceId(forwardingRule.name())
 *             .discoveredService(catalog_service.applyValue(catalog_service -> catalog_service.name()))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   application:
 *     type: gcp:apphub:Application
 *     properties:
 *       location: us-central1
 *       applicationId: example-application-1
 *       scope:
 *         type: REGIONAL
 *   serviceProject:
 *     type: gcp:organizations:Project
 *     name: service_project
 *     properties:
 *       projectId: project-1
 *       name: Service Project
 *       orgId: '123456789'
 *       billingAccount: 000000-0000000-0000000-000000
 *   # Enable Compute API
 *   computeServiceProject:
 *     type: gcp:projects:Service
 *     name: compute_service_project
 *     properties:
 *       project: ${serviceProject.projectId}
 *       service: compute.googleapis.com
 *   wait120s:
 *     type: time:sleep
 *     name: wait_120s
 *     properties:
 *       createDuration: 120s
 *     options:
 *       dependson:
 *         - ${computeServiceProject}
 *   serviceProjectAttachment:
 *     type: gcp:apphub:ServiceProjectAttachment
 *     name: service_project_attachment
 *     properties:
 *       serviceProjectAttachmentId: ${serviceProject.projectId}
 *     options:
 *       dependson:
 *         - ${wait120s}
 *   wait120sForResourceIngestion:
 *     type: time:sleep
 *     name: wait_120s_for_resource_ingestion
 *     properties:
 *       createDuration: 120s
 *     options:
 *       dependson:
 *         - ${forwardingRule}
 *   example:
 *     type: gcp:apphub:Service
 *     properties:
 *       location: us-central1
 *       applicationId: ${application.applicationId}
 *       serviceId: ${forwardingRule.name}
 *       discoveredService: ${["catalog-service"].name}
 *   # VPC network
 *   ilbNetwork:
 *     type: gcp:compute:Network
 *     name: ilb_network
 *     properties:
 *       name: l7-ilb-network
 *       project: ${serviceProject.projectId}
 *       autoCreateSubnetworks: false
 *     options:
 *       dependson:
 *         - ${wait120s}
 *   # backend subnet
 *   ilbSubnet:
 *     type: gcp:compute:Subnetwork
 *     name: ilb_subnet
 *     properties:
 *       name: l7-ilb-subnet
 *       project: ${serviceProject.projectId}
 *       ipCidrRange: 10.0.1.0/24
 *       region: us-central1
 *       network: ${ilbNetwork.id}
 *   # forwarding rule
 *   forwardingRule:
 *     type: gcp:compute:ForwardingRule
 *     name: forwarding_rule
 *     properties:
 *       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}
 *   # backend service
 *   backend:
 *     type: gcp:compute:RegionBackendService
 *     properties:
 *       name: l7-ilb-backend-subnet
 *       project: ${serviceProject.projectId}
 *       region: us-central1
 *       healthChecks: ${default.id}
 *   # health check
 *   default:
 *     type: gcp:compute:HealthCheck
 *     properties:
 *       name: l7-ilb-hc
 *       project: ${serviceProject.projectId}
 *       checkIntervalSec: 1
 *       timeoutSec: 1
 *       tcpHealthCheck:
 *         port: '80'
 *     options:
 *       dependson:
 *         - ${wait120s}
 * variables:
 *   # discovered service block
 *   catalog-service:
 *     fn::invoke:
 *       Function: gcp:apphub:getDiscoveredService
 *       Arguments:
 *         location: us-central1
 *         serviceUri: //compute.googleapis.com/${forwardingRule.id}
 * ```
 * 
 * ### 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",
 * });
 * // 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: "[email protected]",
 *         }],
 *         developerOwners: [{
 *             displayName: "Bob",
 *             email: "[email protected]",
 *         }],
 *         operatorOwners: [{
 *             displayName: "Charlie",
 *             email: "[email protected]",
 *         }],
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * import pulumi_time as time
 * application = gcp.apphub.Application("application",
 *     location="us-central1",
 *     application_id="example-application-1",
 *     scope={
 *         "type": "REGIONAL",
 *     })
 * service_project = gcp.organizations.Project("service_project",
 *     project_id="project-1",
 *     name="Service Project",
 *     org_id="123456789",
 *     billing_account="000000-0000000-0000000-000000")
 * # Enable Compute API
 * compute_service_project = gcp.projects.Service("compute_service_project",
 *     project=service_project.project_id,
 *     service="compute.googleapis.com")
 * wait120s = time.index.Sleep("wait_120s", create_duration=120s,
 * opts = pulumi.ResourceOptions(depends_on=[compute_service_project]))
 * service_project_attachment = gcp.apphub.ServiceProjectAttachment("service_project_attachment", service_project_attachment_id=service_project.project_id,
 * opts = pulumi.ResourceOptions(depends_on=[wait120s]))
 * # VPC network
 * ilb_network = gcp.compute.Network("ilb_network",
 *     name="l7-ilb-network",
 *     project=service_project.project_id,
 *     auto_create_subnetworks=False,
 *     opts = pulumi.ResourceOptions(depends_on=[wait120s]))
 * # backend subnet
 * ilb_subnet = gcp.compute.Subnetwork("ilb_subnet",
 *     name="l7-ilb-subnet",
 *     project=service_project.project_id,
 *     ip_cidr_range="10.0.1.0/24",
 *     region="us-central1",
 *     network=ilb_network.id)
 * # health check
 * default = gcp.compute.HealthCheck("default",
 *     name="l7-ilb-hc",
 *     project=service_project.project_id,
 *     check_interval_sec=1,
 *     timeout_sec=1,
 *     tcp_health_check={
 *         "port": 80,
 *     },
 *     opts = pulumi.ResourceOptions(depends_on=[wait120s]))
 * # backend service
 * backend = gcp.compute.RegionBackendService("backend",
 *     name="l7-ilb-backend-subnet",
 *     project=service_project.project_id,
 *     region="us-central1",
 *     health_checks=default.id)
 * # forwarding rule
 * forwarding_rule = gcp.compute.ForwardingRule("forwarding_rule",
 *     name="l7-ilb-forwarding-rule",
 *     project=service_project.project_id,
 *     region="us-central1",
 *     ip_version="IPV4",
 *     load_balancing_scheme="INTERNAL",
 *     all_ports=True,
 *     backend_service=backend.id,
 *     network=ilb_network.id,
 *     subnetwork=ilb_subnet.id)
 * # discovered service block
 * catalog_service = gcp.apphub.get_discovered_service_output(location="us-central1",
 *     service_uri=forwarding_rule.id.apply(lambda id: f"//compute.googleapis.com/{id}"))
 * wait120s_for_resource_ingestion = time.index.Sleep("wait_120s_for_resource_ingestion", create_duration=120s,
 * opts = pulumi.ResourceOptions(depends_on=[forwarding_rule]))
 * example = gcp.apphub.Service("example",
 *     location="us-central1",
 *     application_id=application.application_id,
 *     service_id=forwarding_rule.name,
 *     discovered_service=catalog_service.name,
 *     display_name="Example Service Full",
 *     description="Register service for testing",
 *     attributes={
 *         "environment": {
 *             "type": "STAGING",
 *         },
 *         "criticality": {
 *             "type": "MISSION_CRITICAL",
 *         },
 *         "business_owners": [{
 *             "display_name": "Alice",
 *             "email": "[email protected]",
 *         }],
 *         "developer_owners": [{
 *             "display_name": "Bob",
 *             "email": "[email protected]",
 *         }],
 *         "operator_owners": [{
 *             "display_name": "Charlie",
 *             "email": "[email protected]",
 *         }],
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * using Time = Pulumi.Time;
 * return await Deployment.RunAsync(() =>
 * {
 *     var application = new Gcp.Apphub.Application("application", new()
 *     {
 *         Location = "us-central1",
 *         ApplicationId = "example-application-1",
 *         Scope = new Gcp.Apphub.Inputs.ApplicationScopeArgs
 *         {
 *             Type = "REGIONAL",
 *         },
 *     });
 *     var serviceProject = new Gcp.Organizations.Project("service_project", new()
 *     {
 *         ProjectId = "project-1",
 *         Name = "Service Project",
 *         OrgId = "123456789",
 *         BillingAccount = "000000-0000000-0000000-000000",
 *     });
 *     // Enable Compute API
 *     var computeServiceProject = new Gcp.Projects.Service("compute_service_project", new()
 *     {
 *         Project = serviceProject.ProjectId,
 *         ServiceName = "compute.googleapis.com",
 *     });
 *     var wait120s = new Time.Index.Sleep("wait_120s", new()
 *     {
 *         CreateDuration = "120s",
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             computeServiceProject,
 *         },
 *     });
 *     var serviceProjectAttachment = new Gcp.Apphub.ServiceProjectAttachment("service_project_attachment", new()
 *     {
 *         ServiceProjectAttachmentId = serviceProject.ProjectId,
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             wait120s,
 *         },
 *     });
 *     // VPC network
 *     var ilbNetwork = new Gcp.Compute.Network("ilb_network", new()
 *     {
 *         Name = "l7-ilb-network",
 *         Project = serviceProject.ProjectId,
 *         AutoCreateSubnetworks = false,
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             wait120s,
 *         },
 *     });
 *     // backend subnet
 *     var ilbSubnet = new Gcp.Compute.Subnetwork("ilb_subnet", new()
 *     {
 *         Name = "l7-ilb-subnet",
 *         Project = serviceProject.ProjectId,
 *         IpCidrRange = "10.0.1.0/24",
 *         Region = "us-central1",
 *         Network = ilbNetwork.Id,
 *     });
 *     // health check
 *     var @default = new Gcp.Compute.HealthCheck("default", new()
 *     {
 *         Name = "l7-ilb-hc",
 *         Project = serviceProject.ProjectId,
 *         CheckIntervalSec = 1,
 *         TimeoutSec = 1,
 *         TcpHealthCheck = new Gcp.Compute.Inputs.HealthCheckTcpHealthCheckArgs
 *         {
 *             Port = 80,
 *         },
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             wait120s,
 *         },
 *     });
 *     // backend service
 *     var backend = new Gcp.Compute.RegionBackendService("backend", new()
 *     {
 *         Name = "l7-ilb-backend-subnet",
 *         Project = serviceProject.ProjectId,
 *         Region = "us-central1",
 *         HealthChecks = @default.Id,
 *     });
 *     // forwarding rule
 *     var forwardingRule = new Gcp.Compute.ForwardingRule("forwarding_rule", new()
 *     {
 *         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
 *     var catalog_service = Gcp.Apphub.GetDiscoveredService.Invoke(new()
 *     {
 *         Location = "us-central1",
 *         ServiceUri = $"//compute.googleapis.com/{forwardingRule.Id}",
 *     });
 *     var wait120sForResourceIngestion = new Time.Index.Sleep("wait_120s_for_resource_ingestion", new()
 *     {
 *         CreateDuration = "120s",
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             forwardingRule,
 *         },
 *     });
 *     var example = new Gcp.Apphub.Service("example", new()
 *     {
 *         Location = "us-central1",
 *         ApplicationId = application.ApplicationId,
 *         ServiceId = forwardingRule.Name,
 *         DiscoveredService = catalog_service.Apply(catalog_service => catalog_service.Apply(getDiscoveredServiceResult => getDiscoveredServiceResult.Name)),
 *         DisplayName = "Example Service Full",
 *         Description = "Register service for testing",
 *         Attributes = new Gcp.Apphub.Inputs.ServiceAttributesArgs
 *         {
 *             Environment = new Gcp.Apphub.Inputs.ServiceAttributesEnvironmentArgs
 *             {
 *                 Type = "STAGING",
 *             },
 *             Criticality = new Gcp.Apphub.Inputs.ServiceAttributesCriticalityArgs
 *             {
 *                 Type = "MISSION_CRITICAL",
 *             },
 *             BusinessOwners = new[]
 *             {
 *                 new Gcp.Apphub.Inputs.ServiceAttributesBusinessOwnerArgs
 *                 {
 *                     DisplayName = "Alice",
 *                     Email = "[email protected]",
 *                 },
 *             },
 *             DeveloperOwners = new[]
 *             {
 *                 new Gcp.Apphub.Inputs.ServiceAttributesDeveloperOwnerArgs
 *                 {
 *                     DisplayName = "Bob",
 *                     Email = "[email protected]",
 *                 },
 *             },
 *             OperatorOwners = new[]
 *             {
 *                 new Gcp.Apphub.Inputs.ServiceAttributesOperatorOwnerArgs
 *                 {
 *                     DisplayName = "Charlie",
 *                     Email = "[email protected]",
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"fmt"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/apphub"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
 * 	"github.com/pulumi/pulumi-time/sdk/go/time"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		application, err := apphub.NewApplication(ctx, "application", &apphub.ApplicationArgs{
 * 			Location:      pulumi.String("us-central1"),
 * 			ApplicationId: pulumi.String("example-application-1"),
 * 			Scope: &apphub.ApplicationScopeArgs{
 * 				Type: pulumi.String("REGIONAL"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		serviceProject, err := organizations.NewProject(ctx, "service_project", &organizations.ProjectArgs{
 * 			ProjectId:      pulumi.String("project-1"),
 * 			Name:           pulumi.String("Service Project"),
 * 			OrgId:          pulumi.String("123456789"),
 * 			BillingAccount: pulumi.String("000000-0000000-0000000-000000"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// Enable Compute API
 * 		computeServiceProject, err := projects.NewService(ctx, "compute_service_project", &projects.ServiceArgs{
 * 			Project: serviceProject.ProjectId,
 * 			Service: pulumi.String("compute.googleapis.com"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		wait120s, err := time.NewSleep(ctx, "wait_120s", &time.SleepArgs{
 * 			CreateDuration: "120s",
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			computeServiceProject,
 * 		}))
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = apphub.NewServiceProjectAttachment(ctx, "service_project_attachment", &apphub.ServiceProjectAttachmentArgs{
 * 			ServiceProjectAttachmentId: serviceProject.ProjectId,
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			wait120s,
 * 		}))
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// VPC network
 * 		ilbNetwork, err := compute.NewNetwork(ctx, "ilb_network", &compute.NetworkArgs{
 * 			Name:                  pulumi.String("l7-ilb-network"),
 * 			Project:               serviceProject.ProjectId,
 * 			AutoCreateSubnetworks: pulumi.Bool(false),
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			wait120s,
 * 		}))
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// backend subnet
 * 		ilbSubnet, err := compute.NewSubnetwork(ctx, "ilb_subnet", &compute.SubnetworkArgs{
 * 			Name:        pulumi.String("l7-ilb-subnet"),
 * 			Project:     serviceProject.ProjectId,
 * 			IpCidrRange: pulumi.String("10.0.1.0/24"),
 * 			Region:      pulumi.String("us-central1"),
 * 			Network:     ilbNetwork.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// health check
 * 		_, err = compute.NewHealthCheck(ctx, "default", &compute.HealthCheckArgs{
 * 			Name:             pulumi.String("l7-ilb-hc"),
 * 			Project:          serviceProject.ProjectId,
 * 			CheckIntervalSec: pulumi.Int(1),
 * 			TimeoutSec:       pulumi.Int(1),
 * 			TcpHealthCheck: &compute.HealthCheckTcpHealthCheckArgs{
 * 				Port: pulumi.Int(80),
 * 			},
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			wait120s,
 * 		}))
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// backend service
 * 		backend, err := compute.NewRegionBackendService(ctx, "backend", &compute.RegionBackendServiceArgs{
 * 			Name:         pulumi.String("l7-ilb-backend-subnet"),
 * 			Project:      serviceProject.ProjectId,
 * 			Region:       pulumi.String("us-central1"),
 * 			HealthChecks: _default.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// forwarding rule
 * 		forwardingRule, err := compute.NewForwardingRule(ctx, "forwarding_rule", &compute.ForwardingRuleArgs{
 * 			Name:                pulumi.String("l7-ilb-forwarding-rule"),
 * 			Project:             serviceProject.ProjectId,
 * 			Region:              pulumi.String("us-central1"),
 * 			IpVersion:           pulumi.String("IPV4"),
 * 			LoadBalancingScheme: pulumi.String("INTERNAL"),
 * 			AllPorts:            pulumi.Bool(true),
 * 			BackendService:      backend.ID(),
 * 			Network:             ilbNetwork.ID(),
 * 			Subnetwork:          ilbSubnet.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// discovered service block
 * 		catalog_service := apphub.GetDiscoveredServiceOutput(ctx, apphub.GetDiscoveredServiceOutputArgs{
 * 			Location: pulumi.String("us-central1"),
 * 			ServiceUri: forwardingRule.ID().ApplyT(func(id string) (string, error) {
 * 				return fmt.Sprintf("//compute.googleapis.com/%v", id), nil
 * 			}).(pulumi.StringOutput),
 * 		}, nil)
 * 		_, err = time.NewSleep(ctx, "wait_120s_for_resource_ingestion", &time.SleepArgs{
 * 			CreateDuration: "120s",
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			forwardingRule,
 * 		}))
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = apphub.NewService(ctx, "example", &apphub.ServiceArgs{
 * 			Location:      pulumi.String("us-central1"),
 * 			ApplicationId: application.ApplicationId,
 * 			ServiceId:     forwardingRule.Name,
 * 			DiscoveredService: pulumi.String(catalog_service.ApplyT(func(catalog_service apphub.GetDiscoveredServiceResult) (*string, error) {
 * 				return &catalog_service.Name, nil
 * 			}).(pulumi.StringPtrOutput)),
 * 			DisplayName: pulumi.String("Example Service Full"),
 * 			Description: pulumi.String("Register service for testing"),
 * 			Attributes: &apphub.ServiceAttributesArgs{
 * 				Environment: &apphub.ServiceAttributesEnvironmentArgs{
 * 					Type: pulumi.String("STAGING"),
 * 				},
 * 				Criticality: &apphub.ServiceAttributesCriticalityArgs{
 * 					Type: pulumi.String("MISSION_CRITICAL"),
 * 				},
 * 				BusinessOwners: apphub.ServiceAttributesBusinessOwnerArray{
 * 					&apphub.ServiceAttributesBusinessOwnerArgs{
 * 						DisplayName: pulumi.String("Alice"),
 * 						Email:       pulumi.String("[email protected]"),
 * 					},
 * 				},
 * 				DeveloperOwners: apphub.ServiceAttributesDeveloperOwnerArray{
 * 					&apphub.ServiceAttributesDeveloperOwnerArgs{
 * 						DisplayName: pulumi.String("Bob"),
 * 						Email:       pulumi.String("[email protected]"),
 * 					},
 * 				},
 * 				OperatorOwners: apphub.ServiceAttributesOperatorOwnerArray{
 * 					&apphub.ServiceAttributesOperatorOwnerArgs{
 * 						DisplayName: pulumi.String("Charlie"),
 * 						Email:       pulumi.String("[email protected]"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.apphub.Application;
 * import com.pulumi.gcp.apphub.ApplicationArgs;
 * import com.pulumi.gcp.apphub.inputs.ApplicationScopeArgs;
 * import com.pulumi.gcp.organizations.Project;
 * import com.pulumi.gcp.organizations.ProjectArgs;
 * import com.pulumi.gcp.projects.Service;
 * import com.pulumi.gcp.projects.ServiceArgs;
 * import com.pulumi.time.sleep;
 * import com.pulumi.time.SleepArgs;
 * import com.pulumi.gcp.apphub.ServiceProjectAttachment;
 * import com.pulumi.gcp.apphub.ServiceProjectAttachmentArgs;
 * import com.pulumi.gcp.compute.Network;
 * import com.pulumi.gcp.compute.NetworkArgs;
 * import com.pulumi.gcp.compute.Subnetwork;
 * import com.pulumi.gcp.compute.SubnetworkArgs;
 * import com.pulumi.gcp.compute.HealthCheck;
 * import com.pulumi.gcp.compute.HealthCheckArgs;
 * import com.pulumi.gcp.compute.inputs.HealthCheckTcpHealthCheckArgs;
 * import com.pulumi.gcp.compute.RegionBackendService;
 * import com.pulumi.gcp.compute.RegionBackendServiceArgs;
 * import com.pulumi.gcp.compute.ForwardingRule;
 * import com.pulumi.gcp.compute.ForwardingRuleArgs;
 * import com.pulumi.gcp.apphub.ApphubFunctions;
 * import com.pulumi.gcp.apphub.inputs.GetDiscoveredServiceArgs;
 * import com.pulumi.gcp.apphub.Service;
 * import com.pulumi.gcp.apphub.ServiceArgs;
 * import com.pulumi.gcp.apphub.inputs.ServiceAttributesArgs;
 * import com.pulumi.gcp.apphub.inputs.ServiceAttributesEnvironmentArgs;
 * import com.pulumi.gcp.apphub.inputs.ServiceAttributesCriticalityArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var application = new Application("application", ApplicationArgs.builder()
 *             .location("us-central1")
 *             .applicationId("example-application-1")
 *             .scope(ApplicationScopeArgs.builder()
 *                 .type("REGIONAL")
 *                 .build())
 *             .build());
 *         var serviceProject = new Project("serviceProject", ProjectArgs.builder()
 *             .projectId("project-1")
 *             .name("Service Project")
 *             .orgId("123456789")
 *             .billingAccount("000000-0000000-0000000-000000")
 *             .build());
 *         // Enable Compute API
 *         var computeServiceProject = new Service("computeServiceProject", ServiceArgs.builder()
 *             .project(serviceProject.projectId())
 *             .service("compute.googleapis.com")
 *             .build());
 *         var wait120s = new Sleep("wait120s", SleepArgs.builder()
 *             .createDuration("120s")
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(computeServiceProject)
 *                 .build());
 *         var serviceProjectAttachment = new ServiceProjectAttachment("serviceProjectAttachment", ServiceProjectAttachmentArgs.builder()
 *             .serviceProjectAttachmentId(serviceProject.projectId())
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(wait120s)
 *                 .build());
 *         // VPC network
 *         var ilbNetwork = new Network("ilbNetwork", NetworkArgs.builder()
 *             .name("l7-ilb-network")
 *             .project(serviceProject.projectId())
 *             .autoCreateSubnetworks(false)
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(wait120s)
 *                 .build());
 *         // backend subnet
 *         var ilbSubnet = new Subnetwork("ilbSubnet", SubnetworkArgs.builder()
 *             .name("l7-ilb-subnet")
 *             .project(serviceProject.projectId())
 *             .ipCidrRange("10.0.1.0/24")
 *             .region("us-central1")
 *             .network(ilbNetwork.id())
 *             .build());
 *         // health check
 *         var default_ = new HealthCheck("default", HealthCheckArgs.builder()
 *             .name("l7-ilb-hc")
 *             .project(serviceProject.projectId())
 *             .checkIntervalSec(1)
 *             .timeoutSec(1)
 *             .tcpHealthCheck(HealthCheckTcpHealthCheckArgs.builder()
 *                 .port("80")
 *                 .build())
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(wait120s)
 *                 .build());
 *         // backend service
 *         var backend = new RegionBackendService("backend", RegionBackendServiceArgs.builder()
 *             .name("l7-ilb-backend-subnet")
 *             .project(serviceProject.projectId())
 *             .region("us-central1")
 *             .healthChecks(default_.id())
 *             .build());
 *         // forwarding rule
 *         var forwardingRule = new ForwardingRule("forwardingRule", ForwardingRuleArgs.builder()
 *             .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())
 *             .build());
 *         // discovered service block
 *         final var catalog-service = ApphubFunctions.getDiscoveredService(GetDiscoveredServiceArgs.builder()
 *             .location("us-central1")
 *             .serviceUri(forwardingRule.id().applyValue(id -> String.format("//compute.googleapis.com/%s", id)))
 *             .build());
 *         var wait120sForResourceIngestion = new Sleep("wait120sForResourceIngestion", SleepArgs.builder()
 *             .createDuration("120s")
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(forwardingRule)
 *                 .build());
 *         var example = new Service("example", ServiceArgs.builder()
 *             .location("us-central1")
 *             .applicationId(application.applicationId())
 *             .serviceId(forwardingRule.name())
 *             .discoveredService(catalog_service.applyValue(catalog_service -> catalog_service.name()))
 *             .displayName("Example Service Full")
 *             .description("Register service for testing")
 *             .attributes(ServiceAttributesArgs.builder()
 *                 .environment(ServiceAttributesEnvironmentArgs.builder()
 *                     .type("STAGING")
 *                     .build())
 *                 .criticality(ServiceAttributesCriticalityArgs.builder()
 *                     .type("MISSION_CRITICAL")
 *                     .build())
 *                 .businessOwners(ServiceAttributesBusinessOwnerArgs.builder()
 *                     .displayName("Alice")
 *                     .email("[email protected]")
 *                     .build())
 *                 .developerOwners(ServiceAttributesDeveloperOwnerArgs.builder()
 *                     .displayName("Bob")
 *                     .email("[email protected]")
 *                     .build())
 *                 .operatorOwners(ServiceAttributesOperatorOwnerArgs.builder()
 *                     .displayName("Charlie")
 *                     .email("[email protected]")
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   application:
 *     type: gcp:apphub:Application
 *     properties:
 *       location: us-central1
 *       applicationId: example-application-1
 *       scope:
 *         type: REGIONAL
 *   serviceProject:
 *     type: gcp:organizations:Project
 *     name: service_project
 *     properties:
 *       projectId: project-1
 *       name: Service Project
 *       orgId: '123456789'
 *       billingAccount: 000000-0000000-0000000-000000
 *   # Enable Compute API
 *   computeServiceProject:
 *     type: gcp:projects:Service
 *     name: compute_service_project
 *     properties:
 *       project: ${serviceProject.projectId}
 *       service: compute.googleapis.com
 *   wait120s:
 *     type: time:sleep
 *     name: wait_120s
 *     properties:
 *       createDuration: 120s
 *     options:
 *       dependson:
 *         - ${computeServiceProject}
 *   serviceProjectAttachment:
 *     type: gcp:apphub:ServiceProjectAttachment
 *     name: service_project_attachment
 *     properties:
 *       serviceProjectAttachmentId: ${serviceProject.projectId}
 *     options:
 *       dependson:
 *         - ${wait120s}
 *   wait120sForResourceIngestion:
 *     type: time:sleep
 *     name: wait_120s_for_resource_ingestion
 *     properties:
 *       createDuration: 120s
 *     options:
 *       dependson:
 *         - ${forwardingRule}
 *   example:
 *     type: gcp:apphub:Service
 *     properties:
 *       location: us-central1
 *       applicationId: ${application.applicationId}
 *       serviceId: ${forwardingRule.name}
 *       discoveredService: ${["catalog-service"].name}
 *       displayName: Example Service Full
 *       description: Register service for testing
 *       attributes:
 *         environment:
 *           type: STAGING
 *         criticality:
 *           type: MISSION_CRITICAL
 *         businessOwners:
 *           - displayName: Alice
 *             email: [email protected]
 *         developerOwners:
 *           - displayName: Bob
 *             email: [email protected]
 *         operatorOwners:
 *           - displayName: Charlie
 *             email: [email protected]
 *   # VPC network
 *   ilbNetwork:
 *     type: gcp:compute:Network
 *     name: ilb_network
 *     properties:
 *       name: l7-ilb-network
 *       project: ${serviceProject.projectId}
 *       autoCreateSubnetworks: false
 *     options:
 *       dependson:
 *         - ${wait120s}
 *   # backend subnet
 *   ilbSubnet:
 *     type: gcp:compute:Subnetwork
 *     name: ilb_subnet
 *     properties:
 *       name: l7-ilb-subnet
 *       project: ${serviceProject.projectId}
 *       ipCidrRange: 10.0.1.0/24
 *       region: us-central1
 *       network: ${ilbNetwork.id}
 *   # forwarding rule
 *   forwardingRule:
 *     type: gcp:compute:ForwardingRule
 *     name: forwarding_rule
 *     properties:
 *       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}
 *   # backend service
 *   backend:
 *     type: gcp:compute:RegionBackendService
 *     properties:
 *       name: l7-ilb-backend-subnet
 *       project: ${serviceProject.projectId}
 *       region: us-central1
 *       healthChecks: ${default.id}
 *   # health check
 *   default:
 *     type: gcp:compute:HealthCheck
 *     properties:
 *       name: l7-ilb-hc
 *       project: ${serviceProject.projectId}
 *       checkIntervalSec: 1
 *       timeoutSec: 1
 *       tcpHealthCheck:
 *         port: '80'
 *     options:
 *       dependson:
 *         - ${wait120s}
 * variables:
 *   # discovered service block
 *   catalog-service:
 *     fn::invoke:
 *       Function: gcp:apphub:getDiscoveredService
 *       Arguments:
 *         location: us-central1
 *         serviceUri: //compute.googleapis.com/${forwardingRule.id}
 * ```
 * 
 * ## 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}}
 * ```
 */
public class Service internal constructor(
    override val javaResource: com.pulumi.gcp.apphub.Service,
) : KotlinCustomResource(javaResource, ServiceMapper) {
    /**
     * Part of `parent`.  Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
     */
    public val applicationId: Output
        get() = javaResource.applicationId().applyValue({ args0 -> args0 })

    /**
     * Consumer provided attributes.
     * Structure is documented below.
     */
    public val attributes: Output?
        get() = javaResource.attributes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    serviceAttributesToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Output only. Create time.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * User-defined description of a Service.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Immutable. The resource name of the original discovered service.
     */
    public val discoveredService: Output
        get() = javaResource.discoveredService().applyValue({ args0 -> args0 })

    /**
     * User-defined name for the Service.
     */
    public val displayName: Output?
        get() = javaResource.displayName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Part of `parent`.  Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Identifier. The resource name of a Service. Format:
     * "projects/{host-project-id}/locations/{location}/applications/{application-id}/services/{service-id}"
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * The Service identifier.
     * - - -
     */
    public val serviceId: Output
        get() = javaResource.serviceId().applyValue({ args0 -> args0 })

    /**
     * Properties of an underlying cloud resource that can comprise a Service.
     * Structure is documented below.
     */
    public val serviceProperties: Output>
        get() = javaResource.serviceProperties().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> serviceServicePropertyToKotlin(args0) })
            })
        })

    /**
     * Reference to an underlying networking resource that can comprise a Service.
     * Structure is documented below.
     */
    public val serviceReferences: Output>
        get() = javaResource.serviceReferences().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> serviceServiceReferenceToKotlin(args0) })
            })
        })

    /**
     * Output only. Service state. Possible values: STATE_UNSPECIFIED CREATING ACTIVE DELETING DETACHED
     */
    public val state: Output
        get() = javaResource.state().applyValue({ args0 -> args0 })

    /**
     * Output only. A universally unique identifier (UUID) for the `Service` in the UUID4
     * format.
     */
    public val uid: Output
        get() = javaResource.uid().applyValue({ args0 -> args0 })

    /**
     * Output only. Update time.
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })
}

public object ServiceMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.apphub.Service::class == javaResource::class

    override fun map(javaResource: Resource): Service = Service(
        javaResource as
            com.pulumi.gcp.apphub.Service,
    )
}

/**
 * @see [Service].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [Service].
 */
public suspend fun service(name: String, block: suspend ServiceResourceBuilder.() -> Unit): Service {
    val builder = ServiceResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [Service].
 * @param name The _unique_ name of the resulting resource.
 */
public fun service(name: String): Service {
    val builder = ServiceResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy