1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. apphub
  5. Service
Google Cloud v8.26.0 published on Thursday, Apr 10, 2025 by Pulumi

gcp.apphub.Service

Explore with Pulumi AI

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

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),
});
Copy
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",
    deletion_policy="DELETE")
# 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)
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/apphub"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
	"github.com/pulumi/pulumi-gcp/sdk/v8/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"),
			DeletionPolicy: pulumi.String("DELETE"),
		})
		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
		_default, 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
	})
}
Copy
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",
        DeletionPolicy = "DELETE",
    });

    // 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)),
    });

});
Copy
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.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.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")
            .deletionPolicy("DELETE")
            .build());

        // Enable Compute API
        var computeServiceProject = new com.pulumi.gcp.projects.Service("computeServiceProject", com.pulumi.gcp.projects.ServiceArgs.builder()
            .project(serviceProject.projectId())
            .service("compute.googleapis.com")
            .build());

        var wait120s = new Sleep("wait120s", SleepArgs.builder()
            .createDuration("120s")
            .build(), CustomResourceOptions.builder()
                .dependsOn(List.of(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(List.of(forwardingRule))
                .build());

        var example = new com.pulumi.gcp.apphub.Service("example", com.pulumi.gcp.apphub.ServiceArgs.builder()
            .location("us-central1")
            .applicationId(application.applicationId())
            .serviceId(forwardingRule.name())
            .discoveredService(catalog_service.applyValue(_catalog_service -> _catalog_service.name()))
            .build());

    }
}
Copy
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
      deletionPolicy: DELETE
  # 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}
Copy

Apphub Service Full

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",
        }],
    },
});
Copy
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",
    deletion_policy="DELETE")
# 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": "alice@google.com",
        }],
        "developer_owners": [{
            "display_name": "Bob",
            "email": "bob@google.com",
        }],
        "operator_owners": [{
            "display_name": "Charlie",
            "email": "charlie@google.com",
        }],
    })
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/apphub"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
	"github.com/pulumi/pulumi-gcp/sdk/v8/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"),
			DeletionPolicy: pulumi.String("DELETE"),
		})
		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
		_default, 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("alice@google.com"),
					},
				},
				DeveloperOwners: apphub.ServiceAttributesDeveloperOwnerArray{
					&apphub.ServiceAttributesDeveloperOwnerArgs{
						DisplayName: pulumi.String("Bob"),
						Email:       pulumi.String("bob@google.com"),
					},
				},
				OperatorOwners: apphub.ServiceAttributesOperatorOwnerArray{
					&apphub.ServiceAttributesOperatorOwnerArgs{
						DisplayName: pulumi.String("Charlie"),
						Email:       pulumi.String("charlie@google.com"),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
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",
        DeletionPolicy = "DELETE",
    });

    // 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 = "alice@google.com",
                },
            },
            DeveloperOwners = new[]
            {
                new Gcp.Apphub.Inputs.ServiceAttributesDeveloperOwnerArgs
                {
                    DisplayName = "Bob",
                    Email = "bob@google.com",
                },
            },
            OperatorOwners = new[]
            {
                new Gcp.Apphub.Inputs.ServiceAttributesOperatorOwnerArgs
                {
                    DisplayName = "Charlie",
                    Email = "charlie@google.com",
                },
            },
        },
    });

});
Copy
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.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.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")
            .deletionPolicy("DELETE")
            .build());

        // Enable Compute API
        var computeServiceProject = new com.pulumi.gcp.projects.Service("computeServiceProject", com.pulumi.gcp.projects.ServiceArgs.builder()
            .project(serviceProject.projectId())
            .service("compute.googleapis.com")
            .build());

        var wait120s = new Sleep("wait120s", SleepArgs.builder()
            .createDuration("120s")
            .build(), CustomResourceOptions.builder()
                .dependsOn(List.of(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(List.of(forwardingRule))
                .build());

        var example = new com.pulumi.gcp.apphub.Service("example", com.pulumi.gcp.apphub.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("alice@google.com")
                    .build())
                .developerOwners(ServiceAttributesDeveloperOwnerArgs.builder()
                    .displayName("Bob")
                    .email("bob@google.com")
                    .build())
                .operatorOwners(ServiceAttributesOperatorOwnerArgs.builder()
                    .displayName("Charlie")
                    .email("charlie@google.com")
                    .build())
                .build())
            .build());

    }
}
Copy
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
      deletionPolicy: DELETE
  # 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: alice@google.com
        developerOwners:
          - displayName: Bob
            email: bob@google.com
        operatorOwners:
          - displayName: Charlie
            email: charlie@google.com
  # 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}
Copy

Create Service Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Service(name: string, args: ServiceArgs, opts?: CustomResourceOptions);
@overload
def Service(resource_name: str,
            args: ServiceArgs,
            opts: Optional[ResourceOptions] = None)

@overload
def Service(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            application_id: Optional[str] = None,
            discovered_service: Optional[str] = None,
            location: Optional[str] = None,
            service_id: Optional[str] = None,
            attributes: Optional[ServiceAttributesArgs] = None,
            description: Optional[str] = None,
            display_name: Optional[str] = None,
            project: Optional[str] = None)
func NewService(ctx *Context, name string, args ServiceArgs, opts ...ResourceOption) (*Service, error)
public Service(string name, ServiceArgs args, CustomResourceOptions? opts = null)
public Service(String name, ServiceArgs args)
public Service(String name, ServiceArgs args, CustomResourceOptions options)
type: gcp:apphub:Service
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ServiceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ServiceArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ServiceArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ServiceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ServiceArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var serviceResource = new Gcp.Apphub.Service("serviceResource", new()
{
    ApplicationId = "string",
    DiscoveredService = "string",
    Location = "string",
    ServiceId = "string",
    Attributes = new Gcp.Apphub.Inputs.ServiceAttributesArgs
    {
        BusinessOwners = new[]
        {
            new Gcp.Apphub.Inputs.ServiceAttributesBusinessOwnerArgs
            {
                Email = "string",
                DisplayName = "string",
            },
        },
        Criticality = new Gcp.Apphub.Inputs.ServiceAttributesCriticalityArgs
        {
            Type = "string",
        },
        DeveloperOwners = new[]
        {
            new Gcp.Apphub.Inputs.ServiceAttributesDeveloperOwnerArgs
            {
                Email = "string",
                DisplayName = "string",
            },
        },
        Environment = new Gcp.Apphub.Inputs.ServiceAttributesEnvironmentArgs
        {
            Type = "string",
        },
        OperatorOwners = new[]
        {
            new Gcp.Apphub.Inputs.ServiceAttributesOperatorOwnerArgs
            {
                Email = "string",
                DisplayName = "string",
            },
        },
    },
    Description = "string",
    DisplayName = "string",
    Project = "string",
});
Copy
example, err := apphub.NewService(ctx, "serviceResource", &apphub.ServiceArgs{
	ApplicationId:     pulumi.String("string"),
	DiscoveredService: pulumi.String("string"),
	Location:          pulumi.String("string"),
	ServiceId:         pulumi.String("string"),
	Attributes: &apphub.ServiceAttributesArgs{
		BusinessOwners: apphub.ServiceAttributesBusinessOwnerArray{
			&apphub.ServiceAttributesBusinessOwnerArgs{
				Email:       pulumi.String("string"),
				DisplayName: pulumi.String("string"),
			},
		},
		Criticality: &apphub.ServiceAttributesCriticalityArgs{
			Type: pulumi.String("string"),
		},
		DeveloperOwners: apphub.ServiceAttributesDeveloperOwnerArray{
			&apphub.ServiceAttributesDeveloperOwnerArgs{
				Email:       pulumi.String("string"),
				DisplayName: pulumi.String("string"),
			},
		},
		Environment: &apphub.ServiceAttributesEnvironmentArgs{
			Type: pulumi.String("string"),
		},
		OperatorOwners: apphub.ServiceAttributesOperatorOwnerArray{
			&apphub.ServiceAttributesOperatorOwnerArgs{
				Email:       pulumi.String("string"),
				DisplayName: pulumi.String("string"),
			},
		},
	},
	Description: pulumi.String("string"),
	DisplayName: pulumi.String("string"),
	Project:     pulumi.String("string"),
})
Copy
var serviceResource = new Service("serviceResource", ServiceArgs.builder()
    .applicationId("string")
    .discoveredService("string")
    .location("string")
    .serviceId("string")
    .attributes(ServiceAttributesArgs.builder()
        .businessOwners(ServiceAttributesBusinessOwnerArgs.builder()
            .email("string")
            .displayName("string")
            .build())
        .criticality(ServiceAttributesCriticalityArgs.builder()
            .type("string")
            .build())
        .developerOwners(ServiceAttributesDeveloperOwnerArgs.builder()
            .email("string")
            .displayName("string")
            .build())
        .environment(ServiceAttributesEnvironmentArgs.builder()
            .type("string")
            .build())
        .operatorOwners(ServiceAttributesOperatorOwnerArgs.builder()
            .email("string")
            .displayName("string")
            .build())
        .build())
    .description("string")
    .displayName("string")
    .project("string")
    .build());
Copy
service_resource = gcp.apphub.Service("serviceResource",
    application_id="string",
    discovered_service="string",
    location="string",
    service_id="string",
    attributes={
        "business_owners": [{
            "email": "string",
            "display_name": "string",
        }],
        "criticality": {
            "type": "string",
        },
        "developer_owners": [{
            "email": "string",
            "display_name": "string",
        }],
        "environment": {
            "type": "string",
        },
        "operator_owners": [{
            "email": "string",
            "display_name": "string",
        }],
    },
    description="string",
    display_name="string",
    project="string")
Copy
const serviceResource = new gcp.apphub.Service("serviceResource", {
    applicationId: "string",
    discoveredService: "string",
    location: "string",
    serviceId: "string",
    attributes: {
        businessOwners: [{
            email: "string",
            displayName: "string",
        }],
        criticality: {
            type: "string",
        },
        developerOwners: [{
            email: "string",
            displayName: "string",
        }],
        environment: {
            type: "string",
        },
        operatorOwners: [{
            email: "string",
            displayName: "string",
        }],
    },
    description: "string",
    displayName: "string",
    project: "string",
});
Copy
type: gcp:apphub:Service
properties:
    applicationId: string
    attributes:
        businessOwners:
            - displayName: string
              email: string
        criticality:
            type: string
        developerOwners:
            - displayName: string
              email: string
        environment:
            type: string
        operatorOwners:
            - displayName: string
              email: string
    description: string
    discoveredService: string
    displayName: string
    location: string
    project: string
    serviceId: string
Copy

Service Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Service resource accepts the following input properties:

ApplicationId
This property is required.
Changes to this property will trigger replacement.
string
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
DiscoveredService
This property is required.
Changes to this property will trigger replacement.
string
Immutable. The resource name of the original discovered service.
Location
This property is required.
Changes to this property will trigger replacement.
string
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
ServiceId
This property is required.
Changes to this property will trigger replacement.
string
The Service identifier.


Attributes ServiceAttributes
Consumer provided attributes. Structure is documented below.
Description string
User-defined description of a Service.
DisplayName string
User-defined name for the Service.
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
ApplicationId
This property is required.
Changes to this property will trigger replacement.
string
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
DiscoveredService
This property is required.
Changes to this property will trigger replacement.
string
Immutable. The resource name of the original discovered service.
Location
This property is required.
Changes to this property will trigger replacement.
string
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
ServiceId
This property is required.
Changes to this property will trigger replacement.
string
The Service identifier.


Attributes ServiceAttributesArgs
Consumer provided attributes. Structure is documented below.
Description string
User-defined description of a Service.
DisplayName string
User-defined name for the Service.
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
applicationId
This property is required.
Changes to this property will trigger replacement.
String
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
discoveredService
This property is required.
Changes to this property will trigger replacement.
String
Immutable. The resource name of the original discovered service.
location
This property is required.
Changes to this property will trigger replacement.
String
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
serviceId
This property is required.
Changes to this property will trigger replacement.
String
The Service identifier.


attributes ServiceAttributes
Consumer provided attributes. Structure is documented below.
description String
User-defined description of a Service.
displayName String
User-defined name for the Service.
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
applicationId
This property is required.
Changes to this property will trigger replacement.
string
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
discoveredService
This property is required.
Changes to this property will trigger replacement.
string
Immutable. The resource name of the original discovered service.
location
This property is required.
Changes to this property will trigger replacement.
string
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
serviceId
This property is required.
Changes to this property will trigger replacement.
string
The Service identifier.


attributes ServiceAttributes
Consumer provided attributes. Structure is documented below.
description string
User-defined description of a Service.
displayName string
User-defined name for the Service.
project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
application_id
This property is required.
Changes to this property will trigger replacement.
str
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
discovered_service
This property is required.
Changes to this property will trigger replacement.
str
Immutable. The resource name of the original discovered service.
location
This property is required.
Changes to this property will trigger replacement.
str
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
service_id
This property is required.
Changes to this property will trigger replacement.
str
The Service identifier.


attributes ServiceAttributesArgs
Consumer provided attributes. Structure is documented below.
description str
User-defined description of a Service.
display_name str
User-defined name for the Service.
project Changes to this property will trigger replacement. str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
applicationId
This property is required.
Changes to this property will trigger replacement.
String
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
discoveredService
This property is required.
Changes to this property will trigger replacement.
String
Immutable. The resource name of the original discovered service.
location
This property is required.
Changes to this property will trigger replacement.
String
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
serviceId
This property is required.
Changes to this property will trigger replacement.
String
The Service identifier.


attributes Property Map
Consumer provided attributes. Structure is documented below.
description String
User-defined description of a Service.
displayName String
User-defined name for the Service.
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Outputs

All input properties are implicitly available as output properties. Additionally, the Service resource produces the following output properties:

CreateTime string
Output only. Create time.
Id string
The provider-assigned unique ID for this managed resource.
Name string
Identifier. The resource name of a Service. Format: "projects/{host-project-id}/locations/{location}/applications/{application-id}/services/{service-id}"
ServiceProperties List<ServiceServiceProperty>
Properties of an underlying cloud resource that can comprise a Service. Structure is documented below.
ServiceReferences List<ServiceServiceReference>
Reference to an underlying networking resource that can comprise a Service. Structure is documented below.
State string
Output only. Service state. Possible values: STATE_UNSPECIFIED CREATING ACTIVE DELETING DETACHED
Uid string
Output only. A universally unique identifier (UUID) for the Service in the UUID4 format.
UpdateTime string
Output only. Update time.
CreateTime string
Output only. Create time.
Id string
The provider-assigned unique ID for this managed resource.
Name string
Identifier. The resource name of a Service. Format: "projects/{host-project-id}/locations/{location}/applications/{application-id}/services/{service-id}"
ServiceProperties []ServiceServiceProperty
Properties of an underlying cloud resource that can comprise a Service. Structure is documented below.
ServiceReferences []ServiceServiceReference
Reference to an underlying networking resource that can comprise a Service. Structure is documented below.
State string
Output only. Service state. Possible values: STATE_UNSPECIFIED CREATING ACTIVE DELETING DETACHED
Uid string
Output only. A universally unique identifier (UUID) for the Service in the UUID4 format.
UpdateTime string
Output only. Update time.
createTime String
Output only. Create time.
id String
The provider-assigned unique ID for this managed resource.
name String
Identifier. The resource name of a Service. Format: "projects/{host-project-id}/locations/{location}/applications/{application-id}/services/{service-id}"
serviceProperties List<ServiceServiceProperty>
Properties of an underlying cloud resource that can comprise a Service. Structure is documented below.
serviceReferences List<ServiceServiceReference>
Reference to an underlying networking resource that can comprise a Service. Structure is documented below.
state String
Output only. Service state. Possible values: STATE_UNSPECIFIED CREATING ACTIVE DELETING DETACHED
uid String
Output only. A universally unique identifier (UUID) for the Service in the UUID4 format.
updateTime String
Output only. Update time.
createTime string
Output only. Create time.
id string
The provider-assigned unique ID for this managed resource.
name string
Identifier. The resource name of a Service. Format: "projects/{host-project-id}/locations/{location}/applications/{application-id}/services/{service-id}"
serviceProperties ServiceServiceProperty[]
Properties of an underlying cloud resource that can comprise a Service. Structure is documented below.
serviceReferences ServiceServiceReference[]
Reference to an underlying networking resource that can comprise a Service. Structure is documented below.
state string
Output only. Service state. Possible values: STATE_UNSPECIFIED CREATING ACTIVE DELETING DETACHED
uid string
Output only. A universally unique identifier (UUID) for the Service in the UUID4 format.
updateTime string
Output only. Update time.
create_time str
Output only. Create time.
id str
The provider-assigned unique ID for this managed resource.
name str
Identifier. The resource name of a Service. Format: "projects/{host-project-id}/locations/{location}/applications/{application-id}/services/{service-id}"
service_properties Sequence[ServiceServiceProperty]
Properties of an underlying cloud resource that can comprise a Service. Structure is documented below.
service_references Sequence[ServiceServiceReference]
Reference to an underlying networking resource that can comprise a Service. Structure is documented below.
state str
Output only. Service state. Possible values: STATE_UNSPECIFIED CREATING ACTIVE DELETING DETACHED
uid str
Output only. A universally unique identifier (UUID) for the Service in the UUID4 format.
update_time str
Output only. Update time.
createTime String
Output only. Create time.
id String
The provider-assigned unique ID for this managed resource.
name String
Identifier. The resource name of a Service. Format: "projects/{host-project-id}/locations/{location}/applications/{application-id}/services/{service-id}"
serviceProperties List<Property Map>
Properties of an underlying cloud resource that can comprise a Service. Structure is documented below.
serviceReferences List<Property Map>
Reference to an underlying networking resource that can comprise a Service. Structure is documented below.
state String
Output only. Service state. Possible values: STATE_UNSPECIFIED CREATING ACTIVE DELETING DETACHED
uid String
Output only. A universally unique identifier (UUID) for the Service in the UUID4 format.
updateTime String
Output only. Update time.

Look up Existing Service Resource

Get an existing Service resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ServiceState, opts?: CustomResourceOptions): Service
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        application_id: Optional[str] = None,
        attributes: Optional[ServiceAttributesArgs] = None,
        create_time: Optional[str] = None,
        description: Optional[str] = None,
        discovered_service: Optional[str] = None,
        display_name: Optional[str] = None,
        location: Optional[str] = None,
        name: Optional[str] = None,
        project: Optional[str] = None,
        service_id: Optional[str] = None,
        service_properties: Optional[Sequence[ServiceServicePropertyArgs]] = None,
        service_references: Optional[Sequence[ServiceServiceReferenceArgs]] = None,
        state: Optional[str] = None,
        uid: Optional[str] = None,
        update_time: Optional[str] = None) -> Service
func GetService(ctx *Context, name string, id IDInput, state *ServiceState, opts ...ResourceOption) (*Service, error)
public static Service Get(string name, Input<string> id, ServiceState? state, CustomResourceOptions? opts = null)
public static Service get(String name, Output<String> id, ServiceState state, CustomResourceOptions options)
resources:  _:    type: gcp:apphub:Service    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ApplicationId Changes to this property will trigger replacement. string
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
Attributes ServiceAttributes
Consumer provided attributes. Structure is documented below.
CreateTime string
Output only. Create time.
Description string
User-defined description of a Service.
DiscoveredService Changes to this property will trigger replacement. string
Immutable. The resource name of the original discovered service.
DisplayName string
User-defined name for the Service.
Location Changes to this property will trigger replacement. string
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
Name string
Identifier. The resource name of a Service. Format: "projects/{host-project-id}/locations/{location}/applications/{application-id}/services/{service-id}"
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
ServiceId Changes to this property will trigger replacement. string
The Service identifier.


ServiceProperties List<ServiceServiceProperty>
Properties of an underlying cloud resource that can comprise a Service. Structure is documented below.
ServiceReferences List<ServiceServiceReference>
Reference to an underlying networking resource that can comprise a Service. Structure is documented below.
State string
Output only. Service state. Possible values: STATE_UNSPECIFIED CREATING ACTIVE DELETING DETACHED
Uid string
Output only. A universally unique identifier (UUID) for the Service in the UUID4 format.
UpdateTime string
Output only. Update time.
ApplicationId Changes to this property will trigger replacement. string
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
Attributes ServiceAttributesArgs
Consumer provided attributes. Structure is documented below.
CreateTime string
Output only. Create time.
Description string
User-defined description of a Service.
DiscoveredService Changes to this property will trigger replacement. string
Immutable. The resource name of the original discovered service.
DisplayName string
User-defined name for the Service.
Location Changes to this property will trigger replacement. string
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
Name string
Identifier. The resource name of a Service. Format: "projects/{host-project-id}/locations/{location}/applications/{application-id}/services/{service-id}"
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
ServiceId Changes to this property will trigger replacement. string
The Service identifier.


ServiceProperties []ServiceServicePropertyArgs
Properties of an underlying cloud resource that can comprise a Service. Structure is documented below.
ServiceReferences []ServiceServiceReferenceArgs
Reference to an underlying networking resource that can comprise a Service. Structure is documented below.
State string
Output only. Service state. Possible values: STATE_UNSPECIFIED CREATING ACTIVE DELETING DETACHED
Uid string
Output only. A universally unique identifier (UUID) for the Service in the UUID4 format.
UpdateTime string
Output only. Update time.
applicationId Changes to this property will trigger replacement. String
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
attributes ServiceAttributes
Consumer provided attributes. Structure is documented below.
createTime String
Output only. Create time.
description String
User-defined description of a Service.
discoveredService Changes to this property will trigger replacement. String
Immutable. The resource name of the original discovered service.
displayName String
User-defined name for the Service.
location Changes to this property will trigger replacement. String
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
name String
Identifier. The resource name of a Service. Format: "projects/{host-project-id}/locations/{location}/applications/{application-id}/services/{service-id}"
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
serviceId Changes to this property will trigger replacement. String
The Service identifier.


serviceProperties List<ServiceServiceProperty>
Properties of an underlying cloud resource that can comprise a Service. Structure is documented below.
serviceReferences List<ServiceServiceReference>
Reference to an underlying networking resource that can comprise a Service. Structure is documented below.
state String
Output only. Service state. Possible values: STATE_UNSPECIFIED CREATING ACTIVE DELETING DETACHED
uid String
Output only. A universally unique identifier (UUID) for the Service in the UUID4 format.
updateTime String
Output only. Update time.
applicationId Changes to this property will trigger replacement. string
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
attributes ServiceAttributes
Consumer provided attributes. Structure is documented below.
createTime string
Output only. Create time.
description string
User-defined description of a Service.
discoveredService Changes to this property will trigger replacement. string
Immutable. The resource name of the original discovered service.
displayName string
User-defined name for the Service.
location Changes to this property will trigger replacement. string
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
name string
Identifier. The resource name of a Service. Format: "projects/{host-project-id}/locations/{location}/applications/{application-id}/services/{service-id}"
project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
serviceId Changes to this property will trigger replacement. string
The Service identifier.


serviceProperties ServiceServiceProperty[]
Properties of an underlying cloud resource that can comprise a Service. Structure is documented below.
serviceReferences ServiceServiceReference[]
Reference to an underlying networking resource that can comprise a Service. Structure is documented below.
state string
Output only. Service state. Possible values: STATE_UNSPECIFIED CREATING ACTIVE DELETING DETACHED
uid string
Output only. A universally unique identifier (UUID) for the Service in the UUID4 format.
updateTime string
Output only. Update time.
application_id Changes to this property will trigger replacement. str
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
attributes ServiceAttributesArgs
Consumer provided attributes. Structure is documented below.
create_time str
Output only. Create time.
description str
User-defined description of a Service.
discovered_service Changes to this property will trigger replacement. str
Immutable. The resource name of the original discovered service.
display_name str
User-defined name for the Service.
location Changes to this property will trigger replacement. str
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
name str
Identifier. The resource name of a Service. Format: "projects/{host-project-id}/locations/{location}/applications/{application-id}/services/{service-id}"
project Changes to this property will trigger replacement. str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
service_id Changes to this property will trigger replacement. str
The Service identifier.


service_properties Sequence[ServiceServicePropertyArgs]
Properties of an underlying cloud resource that can comprise a Service. Structure is documented below.
service_references Sequence[ServiceServiceReferenceArgs]
Reference to an underlying networking resource that can comprise a Service. Structure is documented below.
state str
Output only. Service state. Possible values: STATE_UNSPECIFIED CREATING ACTIVE DELETING DETACHED
uid str
Output only. A universally unique identifier (UUID) for the Service in the UUID4 format.
update_time str
Output only. Update time.
applicationId Changes to this property will trigger replacement. String
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
attributes Property Map
Consumer provided attributes. Structure is documented below.
createTime String
Output only. Create time.
description String
User-defined description of a Service.
discoveredService Changes to this property will trigger replacement. String
Immutable. The resource name of the original discovered service.
displayName String
User-defined name for the Service.
location Changes to this property will trigger replacement. String
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
name String
Identifier. The resource name of a Service. Format: "projects/{host-project-id}/locations/{location}/applications/{application-id}/services/{service-id}"
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
serviceId Changes to this property will trigger replacement. String
The Service identifier.


serviceProperties List<Property Map>
Properties of an underlying cloud resource that can comprise a Service. Structure is documented below.
serviceReferences List<Property Map>
Reference to an underlying networking resource that can comprise a Service. Structure is documented below.
state String
Output only. Service state. Possible values: STATE_UNSPECIFIED CREATING ACTIVE DELETING DETACHED
uid String
Output only. A universally unique identifier (UUID) for the Service in the UUID4 format.
updateTime String
Output only. Update time.

Supporting Types

ServiceAttributes
, ServiceAttributesArgs

BusinessOwners List<ServiceAttributesBusinessOwner>
Business team that ensures user needs are met and value is delivered Structure is documented below.
Criticality ServiceAttributesCriticality
Criticality of the Application, Service, or Workload Structure is documented below.
DeveloperOwners List<ServiceAttributesDeveloperOwner>
Developer team that owns development and coding. Structure is documented below.
Environment ServiceAttributesEnvironment
Environment of the Application, Service, or Workload Structure is documented below.
OperatorOwners List<ServiceAttributesOperatorOwner>
Operator team that ensures runtime and operations. Structure is documented below.
BusinessOwners []ServiceAttributesBusinessOwner
Business team that ensures user needs are met and value is delivered Structure is documented below.
Criticality ServiceAttributesCriticality
Criticality of the Application, Service, or Workload Structure is documented below.
DeveloperOwners []ServiceAttributesDeveloperOwner
Developer team that owns development and coding. Structure is documented below.
Environment ServiceAttributesEnvironment
Environment of the Application, Service, or Workload Structure is documented below.
OperatorOwners []ServiceAttributesOperatorOwner
Operator team that ensures runtime and operations. Structure is documented below.
businessOwners List<ServiceAttributesBusinessOwner>
Business team that ensures user needs are met and value is delivered Structure is documented below.
criticality ServiceAttributesCriticality
Criticality of the Application, Service, or Workload Structure is documented below.
developerOwners List<ServiceAttributesDeveloperOwner>
Developer team that owns development and coding. Structure is documented below.
environment ServiceAttributesEnvironment
Environment of the Application, Service, or Workload Structure is documented below.
operatorOwners List<ServiceAttributesOperatorOwner>
Operator team that ensures runtime and operations. Structure is documented below.
businessOwners ServiceAttributesBusinessOwner[]
Business team that ensures user needs are met and value is delivered Structure is documented below.
criticality ServiceAttributesCriticality
Criticality of the Application, Service, or Workload Structure is documented below.
developerOwners ServiceAttributesDeveloperOwner[]
Developer team that owns development and coding. Structure is documented below.
environment ServiceAttributesEnvironment
Environment of the Application, Service, or Workload Structure is documented below.
operatorOwners ServiceAttributesOperatorOwner[]
Operator team that ensures runtime and operations. Structure is documented below.
business_owners Sequence[ServiceAttributesBusinessOwner]
Business team that ensures user needs are met and value is delivered Structure is documented below.
criticality ServiceAttributesCriticality
Criticality of the Application, Service, or Workload Structure is documented below.
developer_owners Sequence[ServiceAttributesDeveloperOwner]
Developer team that owns development and coding. Structure is documented below.
environment ServiceAttributesEnvironment
Environment of the Application, Service, or Workload Structure is documented below.
operator_owners Sequence[ServiceAttributesOperatorOwner]
Operator team that ensures runtime and operations. Structure is documented below.
businessOwners List<Property Map>
Business team that ensures user needs are met and value is delivered Structure is documented below.
criticality Property Map
Criticality of the Application, Service, or Workload Structure is documented below.
developerOwners List<Property Map>
Developer team that owns development and coding. Structure is documented below.
environment Property Map
Environment of the Application, Service, or Workload Structure is documented below.
operatorOwners List<Property Map>
Operator team that ensures runtime and operations. Structure is documented below.

ServiceAttributesBusinessOwner
, ServiceAttributesBusinessOwnerArgs

Email This property is required. string
Required. Email address of the contacts.
DisplayName string
Contact's name.
Email This property is required. string
Required. Email address of the contacts.
DisplayName string
Contact's name.
email This property is required. String
Required. Email address of the contacts.
displayName String
Contact's name.
email This property is required. string
Required. Email address of the contacts.
displayName string
Contact's name.
email This property is required. str
Required. Email address of the contacts.
display_name str
Contact's name.
email This property is required. String
Required. Email address of the contacts.
displayName String
Contact's name.

ServiceAttributesCriticality
, ServiceAttributesCriticalityArgs

Type This property is required. string
Criticality type. Possible values are: MISSION_CRITICAL, HIGH, MEDIUM, LOW.
Type This property is required. string
Criticality type. Possible values are: MISSION_CRITICAL, HIGH, MEDIUM, LOW.
type This property is required. String
Criticality type. Possible values are: MISSION_CRITICAL, HIGH, MEDIUM, LOW.
type This property is required. string
Criticality type. Possible values are: MISSION_CRITICAL, HIGH, MEDIUM, LOW.
type This property is required. str
Criticality type. Possible values are: MISSION_CRITICAL, HIGH, MEDIUM, LOW.
type This property is required. String
Criticality type. Possible values are: MISSION_CRITICAL, HIGH, MEDIUM, LOW.

ServiceAttributesDeveloperOwner
, ServiceAttributesDeveloperOwnerArgs

Email This property is required. string
Required. Email address of the contacts.
DisplayName string
Contact's name.
Email This property is required. string
Required. Email address of the contacts.
DisplayName string
Contact's name.
email This property is required. String
Required. Email address of the contacts.
displayName String
Contact's name.
email This property is required. string
Required. Email address of the contacts.
displayName string
Contact's name.
email This property is required. str
Required. Email address of the contacts.
display_name str
Contact's name.
email This property is required. String
Required. Email address of the contacts.
displayName String
Contact's name.

ServiceAttributesEnvironment
, ServiceAttributesEnvironmentArgs

Type This property is required. string
Environment type. Possible values are: PRODUCTION, STAGING, TEST, DEVELOPMENT.
Type This property is required. string
Environment type. Possible values are: PRODUCTION, STAGING, TEST, DEVELOPMENT.
type This property is required. String
Environment type. Possible values are: PRODUCTION, STAGING, TEST, DEVELOPMENT.
type This property is required. string
Environment type. Possible values are: PRODUCTION, STAGING, TEST, DEVELOPMENT.
type This property is required. str
Environment type. Possible values are: PRODUCTION, STAGING, TEST, DEVELOPMENT.
type This property is required. String
Environment type. Possible values are: PRODUCTION, STAGING, TEST, DEVELOPMENT.

ServiceAttributesOperatorOwner
, ServiceAttributesOperatorOwnerArgs

Email This property is required. string
Required. Email address of the contacts.
DisplayName string
Contact's name.
Email This property is required. string
Required. Email address of the contacts.
DisplayName string
Contact's name.
email This property is required. String
Required. Email address of the contacts.
displayName String
Contact's name.
email This property is required. string
Required. Email address of the contacts.
displayName string
Contact's name.
email This property is required. str
Required. Email address of the contacts.
display_name str
Contact's name.
email This property is required. String
Required. Email address of the contacts.
displayName String
Contact's name.

ServiceServiceProperty
, ServiceServicePropertyArgs

GcpProject string
(Output) Output only. The service project identifier that the underlying cloud resource resides in.
Location string
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
Zone string
(Output) Output only. The location that the underlying resource resides in if it is zonal, for example, us-west1-a).
GcpProject string
(Output) Output only. The service project identifier that the underlying cloud resource resides in.
Location string
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
Zone string
(Output) Output only. The location that the underlying resource resides in if it is zonal, for example, us-west1-a).
gcpProject String
(Output) Output only. The service project identifier that the underlying cloud resource resides in.
location String
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
zone String
(Output) Output only. The location that the underlying resource resides in if it is zonal, for example, us-west1-a).
gcpProject string
(Output) Output only. The service project identifier that the underlying cloud resource resides in.
location string
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
zone string
(Output) Output only. The location that the underlying resource resides in if it is zonal, for example, us-west1-a).
gcp_project str
(Output) Output only. The service project identifier that the underlying cloud resource resides in.
location str
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
zone str
(Output) Output only. The location that the underlying resource resides in if it is zonal, for example, us-west1-a).
gcpProject String
(Output) Output only. The service project identifier that the underlying cloud resource resides in.
location String
Part of parent. Full resource name of a parent Application. Example: projects/{HOST_PROJECT_ID}/locations/{LOCATION}/applications/{APPLICATION_ID}
zone String
(Output) Output only. The location that the underlying resource resides in if it is zonal, for example, us-west1-a).

ServiceServiceReference
, ServiceServiceReferenceArgs

Uri string
(Output) Output only. The underlying resource URI (For example, URI of Forwarding Rule, URL Map, and Backend Service).
Uri string
(Output) Output only. The underlying resource URI (For example, URI of Forwarding Rule, URL Map, and Backend Service).
uri String
(Output) Output only. The underlying resource URI (For example, URI of Forwarding Rule, URL Map, and Backend Service).
uri string
(Output) Output only. The underlying resource URI (For example, URI of Forwarding Rule, URL Map, and Backend Service).
uri str
(Output) Output only. The underlying resource URI (For example, URI of Forwarding Rule, URL Map, and Backend Service).
uri String
(Output) Output only. The underlying resource URI (For example, URI of Forwarding Rule, URL Map, and Backend Service).

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:

$ pulumi import gcp:apphub/service:Service default projects/{{project}}/locations/{{location}}/applications/{{application_id}}/services/{{service_id}}
Copy
$ pulumi import gcp:apphub/service:Service default {{project}}/{{location}}/{{application_id}}/{{service_id}}
Copy
$ pulumi import gcp:apphub/service:Service default {{location}}/{{application_id}}/{{service_id}}
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Google Cloud (GCP) Classic pulumi/pulumi-gcp
License
Apache-2.0
Notes
This Pulumi package is based on the google-beta Terraform Provider.