1. Packages
  2. Cloudfoundry Provider
  3. API Docs
  4. getService
cloudfoundry 0.54.0 published on Monday, Apr 14, 2025 by cloudfoundry-community

cloudfoundry.getService

Explore with Pulumi AI

cloudfoundry 0.54.0 published on Monday, Apr 14, 2025 by cloudfoundry-community

Gets information on a Cloud Foundry service definition.

Example Usage

The following example looks up a service definition named ‘p-redis’, globally.

import * as pulumi from "@pulumi/pulumi";
import * as cloudfoundry from "@pulumi/cloudfoundry";

const redis = cloudfoundry.getService({
    name: "p-redis",
});
Copy
import pulumi
import pulumi_cloudfoundry as cloudfoundry

redis = cloudfoundry.get_service(name="p-redis")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/cloudfoundry/cloudfoundry"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cloudfoundry.GetService(ctx, &cloudfoundry.GetServiceArgs{
			Name: "p-redis",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudfoundry = Pulumi.Cloudfoundry;

return await Deployment.RunAsync(() => 
{
    var redis = Cloudfoundry.GetService.Invoke(new()
    {
        Name = "p-redis",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudfoundry.CloudfoundryFunctions;
import com.pulumi.cloudfoundry.inputs.GetServiceArgs;
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) {
        final var redis = CloudfoundryFunctions.getService(GetServiceArgs.builder()
            .name("p-redis")
            .build());

    }
}
Copy
variables:
  redis:
    fn::invoke:
      function: cloudfoundry:getService
      arguments:
        name: p-redis
Copy

The following example looks up a service named ‘p-redis’, registered as a space-scoped service within the specified Space id

import * as pulumi from "@pulumi/pulumi";
import * as cloudfoundry from "@pulumi/cloudfoundry";

const redis = cloudfoundry.getService({
    name: "p-redis",
    space: cloudfoundry_space.dev.id,
});
Copy
import pulumi
import pulumi_cloudfoundry as cloudfoundry

redis = cloudfoundry.get_service(name="p-redis",
    space=cloudfoundry_space["dev"]["id"])
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/cloudfoundry/cloudfoundry"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cloudfoundry.GetService(ctx, &cloudfoundry.GetServiceArgs{
			Name:  "p-redis",
			Space: pulumi.StringRef(cloudfoundry_space.Dev.Id),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudfoundry = Pulumi.Cloudfoundry;

return await Deployment.RunAsync(() => 
{
    var redis = Cloudfoundry.GetService.Invoke(new()
    {
        Name = "p-redis",
        Space = cloudfoundry_space.Dev.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudfoundry.CloudfoundryFunctions;
import com.pulumi.cloudfoundry.inputs.GetServiceArgs;
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) {
        final var redis = CloudfoundryFunctions.getService(GetServiceArgs.builder()
            .name("p-redis")
            .space(cloudfoundry_space.dev().id())
            .build());

    }
}
Copy
variables:
  redis:
    fn::invoke:
      function: cloudfoundry:getService
      arguments:
        name: p-redis
        space: ${cloudfoundry_space.dev.id}
Copy

The following example looks up a service named ‘p-redis’, registered as a space-scoped service within the specified Space id provided by a specific service broker (its guid is hardcoded here because service brokers are not always visible to non admin users of cloud foundry).

import * as pulumi from "@pulumi/pulumi";
import * as cloudfoundry from "@pulumi/cloudfoundry";

const redis = cloudfoundry.getService({
    name: "p-redis",
    space: cloudfoundry_space.dev.id,
    serviceBrokerGuid: "5716f06c-b3a2-4e8a-893f-39870b0c9f42",
});
Copy
import pulumi
import pulumi_cloudfoundry as cloudfoundry

redis = cloudfoundry.get_service(name="p-redis",
    space=cloudfoundry_space["dev"]["id"],
    service_broker_guid="5716f06c-b3a2-4e8a-893f-39870b0c9f42")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/cloudfoundry/cloudfoundry"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cloudfoundry.GetService(ctx, &cloudfoundry.GetServiceArgs{
			Name:              "p-redis",
			Space:             pulumi.StringRef(cloudfoundry_space.Dev.Id),
			ServiceBrokerGuid: pulumi.StringRef("5716f06c-b3a2-4e8a-893f-39870b0c9f42"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudfoundry = Pulumi.Cloudfoundry;

return await Deployment.RunAsync(() => 
{
    var redis = Cloudfoundry.GetService.Invoke(new()
    {
        Name = "p-redis",
        Space = cloudfoundry_space.Dev.Id,
        ServiceBrokerGuid = "5716f06c-b3a2-4e8a-893f-39870b0c9f42",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudfoundry.CloudfoundryFunctions;
import com.pulumi.cloudfoundry.inputs.GetServiceArgs;
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) {
        final var redis = CloudfoundryFunctions.getService(GetServiceArgs.builder()
            .name("p-redis")
            .space(cloudfoundry_space.dev().id())
            .serviceBrokerGuid("5716f06c-b3a2-4e8a-893f-39870b0c9f42")
            .build());

    }
}
Copy
variables:
  redis:
    fn::invoke:
      function: cloudfoundry:getService
      arguments:
        name: p-redis
        space: ${cloudfoundry_space.dev.id}
        serviceBrokerGuid: 5716f06c-b3a2-4e8a-893f-39870b0c9f42
Copy

Using getService

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getService(args: GetServiceArgs, opts?: InvokeOptions): Promise<GetServiceResult>
function getServiceOutput(args: GetServiceOutputArgs, opts?: InvokeOptions): Output<GetServiceResult>
Copy
def get_service(id: Optional[str] = None,
                name: Optional[str] = None,
                service_broker_guid: Optional[str] = None,
                space: Optional[str] = None,
                opts: Optional[InvokeOptions] = None) -> GetServiceResult
def get_service_output(id: Optional[pulumi.Input[str]] = None,
                name: Optional[pulumi.Input[str]] = None,
                service_broker_guid: Optional[pulumi.Input[str]] = None,
                space: Optional[pulumi.Input[str]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetServiceResult]
Copy
func GetService(ctx *Context, args *GetServiceArgs, opts ...InvokeOption) (*GetServiceResult, error)
func GetServiceOutput(ctx *Context, args *GetServiceOutputArgs, opts ...InvokeOption) GetServiceResultOutput
Copy

> Note: This function is named GetService in the Go SDK.

public static class GetService 
{
    public static Task<GetServiceResult> InvokeAsync(GetServiceArgs args, InvokeOptions? opts = null)
    public static Output<GetServiceResult> Invoke(GetServiceInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetServiceResult> getService(GetServiceArgs args, InvokeOptions options)
public static Output<GetServiceResult> getService(GetServiceArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: cloudfoundry:index/getService:getService
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
The name of the service to look up
Id string
The GUID of the service
ServiceBrokerGuid string
The guid of the service broker which offers the service. You can use this to filter two equally named services from different brokers.
Space string
The space within which the service is defined (as a space-scoped service)
Name This property is required. string
The name of the service to look up
Id string
The GUID of the service
ServiceBrokerGuid string
The guid of the service broker which offers the service. You can use this to filter two equally named services from different brokers.
Space string
The space within which the service is defined (as a space-scoped service)
name This property is required. String
The name of the service to look up
id String
The GUID of the service
serviceBrokerGuid String
The guid of the service broker which offers the service. You can use this to filter two equally named services from different brokers.
space String
The space within which the service is defined (as a space-scoped service)
name This property is required. string
The name of the service to look up
id string
The GUID of the service
serviceBrokerGuid string
The guid of the service broker which offers the service. You can use this to filter two equally named services from different brokers.
space string
The space within which the service is defined (as a space-scoped service)
name This property is required. str
The name of the service to look up
id str
The GUID of the service
service_broker_guid str
The guid of the service broker which offers the service. You can use this to filter two equally named services from different brokers.
space str
The space within which the service is defined (as a space-scoped service)
name This property is required. String
The name of the service to look up
id String
The GUID of the service
serviceBrokerGuid String
The guid of the service broker which offers the service. You can use this to filter two equally named services from different brokers.
space String
The space within which the service is defined (as a space-scoped service)

getService Result

The following output properties are available:

Id string
The GUID of the service
Name string
ServiceBrokerName string
The name of the service broker that offers the service.
ServicePlans Dictionary<string, string>
Map of service plan GUIDs keyed by service "<service name>/<plan name>"
ServiceBrokerGuid string
Space string
Id string
The GUID of the service
Name string
ServiceBrokerName string
The name of the service broker that offers the service.
ServicePlans map[string]string
Map of service plan GUIDs keyed by service "<service name>/<plan name>"
ServiceBrokerGuid string
Space string
id String
The GUID of the service
name String
serviceBrokerName String
The name of the service broker that offers the service.
servicePlans Map<String,String>
Map of service plan GUIDs keyed by service "<service name>/<plan name>"
serviceBrokerGuid String
space String
id string
The GUID of the service
name string
serviceBrokerName string
The name of the service broker that offers the service.
servicePlans {[key: string]: string}
Map of service plan GUIDs keyed by service "<service name>/<plan name>"
serviceBrokerGuid string
space string
id str
The GUID of the service
name str
service_broker_name str
The name of the service broker that offers the service.
service_plans Mapping[str, str]
Map of service plan GUIDs keyed by service "<service name>/<plan name>"
service_broker_guid str
space str
id String
The GUID of the service
name String
serviceBrokerName String
The name of the service broker that offers the service.
servicePlans Map<String>
Map of service plan GUIDs keyed by service "<service name>/<plan name>"
serviceBrokerGuid String
space String

Package Details

Repository
cloudfoundry cloudfoundry-community/terraform-provider-cloudfoundry
License
Notes
This Pulumi package is based on the cloudfoundry Terraform Provider.
cloudfoundry 0.54.0 published on Monday, Apr 14, 2025 by cloudfoundry-community