1. Registry
  2. Packages
  3. Cloudfoundry Provider
  4. API Docs
  5. ServiceInstanceSharing
Viewing docs for cloudfoundry 1.19.0
published on Friday, Nov 13, 2026 by cloudfoundry
cloudfoundry
Viewing docs for cloudfoundry 1.19.0
published on Friday, Nov 13, 2026 by cloudfoundry

    Provides a resource for managing service instance sharing in Cloud Foundry.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as cloudfoundry from "@pulumi/cloudfoundry";
    
    const my_org = cloudfoundry.getOrg({
        name: orgName,
    });
    const current_space = my_org.then(my_org => cloudfoundry.getSpace({
        name: "current-space",
        org: my_org.id,
    }));
    const space_to_share_with = my_org.then(my_org => cloudfoundry.getSpace({
        name: spaceName,
        org: my_org.id,
    }));
    const another_space_to_share_with = my_org.then(my_org => cloudfoundry.getSpace({
        name: spaceName,
        org: my_org.id,
    }));
    // existing service instance
    const svc = current_space.then(current_space => cloudfoundry.getServiceInstance({
        name: serviceInstanceName,
        space: current_space.id,
    }));
    const instanceSharing = new cloudfoundry.ServiceInstanceSharing("instance_sharing", {
        serviceInstance: svc.then(svc => svc.id),
        spaces: [
            space_to_share_with.then(space_to_share_with => space_to_share_with.id),
            another_space_to_share_with.then(another_space_to_share_with => another_space_to_share_with.id),
        ],
    });
    
    import pulumi
    import pulumi_cloudfoundry as cloudfoundry
    
    my_org = cloudfoundry.get_org(name=org_name)
    current_space = cloudfoundry.get_space(name="current-space",
        org=my_org.id)
    space_to_share_with = cloudfoundry.get_space(name=space_name,
        org=my_org.id)
    another_space_to_share_with = cloudfoundry.get_space(name=space_name,
        org=my_org.id)
    # existing service instance
    svc = cloudfoundry.get_service_instance(name=service_instance_name,
        space=current_space.id)
    instance_sharing = cloudfoundry.ServiceInstanceSharing("instance_sharing",
        service_instance=svc.id,
        spaces=[
            space_to_share_with.id,
            another_space_to_share_with.id,
        ])
    
    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 {
    		my_org, err := cloudfoundry.LookupOrg(ctx, &cloudfoundry.LookupOrgArgs{
    			Name: orgName,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		current_space, err := cloudfoundry.LookupSpace(ctx, &cloudfoundry.LookupSpaceArgs{
    			Name: "current-space",
    			Org:  my_org.Id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		space_to_share_with, err := cloudfoundry.LookupSpace(ctx, &cloudfoundry.LookupSpaceArgs{
    			Name: spaceName,
    			Org:  my_org.Id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		another_space_to_share_with, err := cloudfoundry.LookupSpace(ctx, &cloudfoundry.LookupSpaceArgs{
    			Name: spaceName,
    			Org:  my_org.Id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// existing service instance
    		svc, err := cloudfoundry.LookupServiceInstance(ctx, &cloudfoundry.LookupServiceInstanceArgs{
    			Name:  serviceInstanceName,
    			Space: current_space.Id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = cloudfoundry.NewServiceInstanceSharing(ctx, "instance_sharing", &cloudfoundry.ServiceInstanceSharingArgs{
    			ServiceInstance: pulumi.String(svc.Id),
    			Spaces: pulumi.StringArray{
    				pulumi.String(space_to_share_with.Id),
    				pulumi.String(another_space_to_share_with.Id),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Cloudfoundry = Pulumi.Cloudfoundry;
    
    return await Deployment.RunAsync(() => 
    {
        var my_org = Cloudfoundry.GetOrg.Invoke(new()
        {
            Name = orgName,
        });
    
        var current_space = Cloudfoundry.GetSpace.Invoke(new()
        {
            Name = "current-space",
            Org = my_org.Apply(getOrgResult => getOrgResult.Id),
        });
    
        var space_to_share_with = Cloudfoundry.GetSpace.Invoke(new()
        {
            Name = spaceName,
            Org = my_org.Apply(getOrgResult => getOrgResult.Id),
        });
    
        var another_space_to_share_with = Cloudfoundry.GetSpace.Invoke(new()
        {
            Name = spaceName,
            Org = my_org.Apply(getOrgResult => getOrgResult.Id),
        });
    
        // existing service instance
        var svc = Cloudfoundry.GetServiceInstance.Invoke(new()
        {
            Name = serviceInstanceName,
            Space = current_space.Apply(getSpaceResult => getSpaceResult.Id),
        });
    
        var instanceSharing = new Cloudfoundry.ServiceInstanceSharing("instance_sharing", new()
        {
            ServiceInstance = svc.Apply(getServiceInstanceResult => getServiceInstanceResult.Id),
            Spaces = new[]
            {
                space_to_share_with.Apply(space_to_share_with => space_to_share_with.Apply(getSpaceResult => getSpaceResult.Id)),
                another_space_to_share_with.Apply(another_space_to_share_with => another_space_to_share_with.Apply(getSpaceResult => getSpaceResult.Id)),
            },
        });
    
    });
    
    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.GetOrgArgs;
    import com.pulumi.cloudfoundry.inputs.GetSpaceArgs;
    import com.pulumi.cloudfoundry.inputs.GetServiceInstanceArgs;
    import com.pulumi.cloudfoundry.ServiceInstanceSharing;
    import com.pulumi.cloudfoundry.ServiceInstanceSharingArgs;
    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 my-org = CloudfoundryFunctions.getOrg(GetOrgArgs.builder()
                .name(orgName)
                .build());
    
            final var current-space = CloudfoundryFunctions.getSpace(GetSpaceArgs.builder()
                .name("current-space")
                .org(my_org.id())
                .build());
    
            final var space-to-share-with = CloudfoundryFunctions.getSpace(GetSpaceArgs.builder()
                .name(spaceName)
                .org(my_org.id())
                .build());
    
            final var another-space-to-share-with = CloudfoundryFunctions.getSpace(GetSpaceArgs.builder()
                .name(spaceName)
                .org(my_org.id())
                .build());
    
            // existing service instance
            final var svc = CloudfoundryFunctions.getServiceInstance(GetServiceInstanceArgs.builder()
                .name(serviceInstanceName)
                .space(current_space.id())
                .build());
    
            var instanceSharing = new ServiceInstanceSharing("instanceSharing", ServiceInstanceSharingArgs.builder()
                .serviceInstance(svc.id())
                .spaces(            
                    space_to_share_with.id(),
                    another_space_to_share_with.id())
                .build());
    
        }
    }
    
    resources:
      instanceSharing:
        type: cloudfoundry:ServiceInstanceSharing
        name: instance_sharing
        properties:
          serviceInstance: ${svc.id}
          spaces:
            - ${["space-to-share-with"].id}
            - ${["another-space-to-share-with"].id}
    variables:
      my-org:
        fn::invoke:
          function: cloudfoundry:getOrg
          arguments:
            name: ${orgName}
      current-space:
        fn::invoke:
          function: cloudfoundry:getSpace
          arguments:
            name: current-space
            org: ${["my-org"].id}
      space-to-share-with:
        fn::invoke:
          function: cloudfoundry:getSpace
          arguments:
            name: ${spaceName}
            org: ${["my-org"].id}
      another-space-to-share-with:
        fn::invoke:
          function: cloudfoundry:getSpace
          arguments:
            name: ${spaceName}
            org: ${["my-org"].id}
      # existing service instance
      svc:
        fn::invoke:
          function: cloudfoundry:getServiceInstance
          arguments:
            name: ${serviceInstanceName}
            space: ${["current-space"].id}
    
    Example coming soon!
    

    Create ServiceInstanceSharing Resource

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

    Constructor syntax

    new ServiceInstanceSharing(name: string, args: ServiceInstanceSharingArgs, opts?: CustomResourceOptions);
    @overload
    def ServiceInstanceSharing(resource_name: str,
                               args: ServiceInstanceSharingArgs,
                               opts: Optional[ResourceOptions] = None)
    
    @overload
    def ServiceInstanceSharing(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               service_instance: Optional[str] = None,
                               spaces: Optional[Sequence[str]] = None)
    func NewServiceInstanceSharing(ctx *Context, name string, args ServiceInstanceSharingArgs, opts ...ResourceOption) (*ServiceInstanceSharing, error)
    public ServiceInstanceSharing(string name, ServiceInstanceSharingArgs args, CustomResourceOptions? opts = null)
    public ServiceInstanceSharing(String name, ServiceInstanceSharingArgs args)
    public ServiceInstanceSharing(String name, ServiceInstanceSharingArgs args, CustomResourceOptions options)
    
    type: cloudfoundry:ServiceInstanceSharing
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "cloudfoundry_service_instance_sharing" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args ServiceInstanceSharingArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ServiceInstanceSharingArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ServiceInstanceSharingArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServiceInstanceSharingArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServiceInstanceSharingArgs
    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 serviceInstanceSharingResource = new Cloudfoundry.ServiceInstanceSharing("serviceInstanceSharingResource", new()
    {
        ServiceInstance = "string",
        Spaces = new[]
        {
            "string",
        },
    });
    
    example, err := cloudfoundry.NewServiceInstanceSharing(ctx, "serviceInstanceSharingResource", &cloudfoundry.ServiceInstanceSharingArgs{
    	ServiceInstance: pulumi.String("string"),
    	Spaces: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    resource "cloudfoundry_service_instance_sharing" "serviceInstanceSharingResource" {
      lifecycle {
        create_before_destroy = true
      }
      service_instance = "string"
      spaces           = ["string"]
    }
    
    var serviceInstanceSharingResource = new ServiceInstanceSharing("serviceInstanceSharingResource", ServiceInstanceSharingArgs.builder()
        .serviceInstance("string")
        .spaces("string")
        .build());
    
    service_instance_sharing_resource = cloudfoundry.ServiceInstanceSharing("serviceInstanceSharingResource",
        service_instance="string",
        spaces=["string"])
    
    const serviceInstanceSharingResource = new cloudfoundry.ServiceInstanceSharing("serviceInstanceSharingResource", {
        serviceInstance: "string",
        spaces: ["string"],
    });
    
    type: cloudfoundry:ServiceInstanceSharing
    properties:
        serviceInstance: string
        spaces:
            - string
    

    ServiceInstanceSharing 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 ServiceInstanceSharing resource accepts the following input properties:

    ServiceInstance string
    The ID of the service instance to share.
    Spaces List<string>
    The IDs of the spaces to share the service instance with.
    ServiceInstance string
    The ID of the service instance to share.
    Spaces []string
    The IDs of the spaces to share the service instance with.
    service_instance string
    The ID of the service instance to share.
    spaces list(string)
    The IDs of the spaces to share the service instance with.
    serviceInstance String
    The ID of the service instance to share.
    spaces List<String>
    The IDs of the spaces to share the service instance with.
    serviceInstance string
    The ID of the service instance to share.
    spaces string[]
    The IDs of the spaces to share the service instance with.
    service_instance str
    The ID of the service instance to share.
    spaces Sequence[str]
    The IDs of the spaces to share the service instance with.
    serviceInstance String
    The ID of the service instance to share.
    spaces List<String>
    The IDs of the spaces to share the service instance with.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ServiceInstanceSharing Resource

    Get an existing ServiceInstanceSharing 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?: ServiceInstanceSharingState, opts?: CustomResourceOptions): ServiceInstanceSharing
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            service_instance: Optional[str] = None,
            spaces: Optional[Sequence[str]] = None) -> ServiceInstanceSharing
    func GetServiceInstanceSharing(ctx *Context, name string, id IDInput, state *ServiceInstanceSharingState, opts ...ResourceOption) (*ServiceInstanceSharing, error)
    public static ServiceInstanceSharing Get(string name, Input<string> id, ServiceInstanceSharingState? state, CustomResourceOptions? opts = null)
    public static ServiceInstanceSharing get(String name, Output<String> id, ServiceInstanceSharingState state, CustomResourceOptions options)
    resources:  _:    type: cloudfoundry:ServiceInstanceSharing    get:      id: ${id}
    import {
      to = cloudfoundry_service_instance_sharing.example
      id = "${id}"
    }
    
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    ServiceInstance string
    The ID of the service instance to share.
    Spaces List<string>
    The IDs of the spaces to share the service instance with.
    ServiceInstance string
    The ID of the service instance to share.
    Spaces []string
    The IDs of the spaces to share the service instance with.
    service_instance string
    The ID of the service instance to share.
    spaces list(string)
    The IDs of the spaces to share the service instance with.
    serviceInstance String
    The ID of the service instance to share.
    spaces List<String>
    The IDs of the spaces to share the service instance with.
    serviceInstance string
    The ID of the service instance to share.
    spaces string[]
    The IDs of the spaces to share the service instance with.
    service_instance str
    The ID of the service instance to share.
    spaces Sequence[str]
    The IDs of the spaces to share the service instance with.
    serviceInstance String
    The ID of the service instance to share.
    spaces List<String>
    The IDs of the spaces to share the service instance with.

    Import

    terraform

    $ pulumi import cloudfoundry:index/serviceInstanceSharing:ServiceInstanceSharing <resource_name> <service_instance_guid>
    
    $ pulumi import cloudfoundry:index/serviceInstanceSharing:ServiceInstanceSharing my_instance_sharing a1b2c3d4-5678-90ab-cdef-12345678abcd
    
    $ pulumi import cloudfoundry:index/serviceInstanceSharing:ServiceInstanceSharing #using id attribute in import block
    

    import {

    to = cloudfoundry_service_instance_sharing.<resource_name>

    id = “<service_instance_guid>”

    }

    this resource supports import using identity attribute from Terraform version 1.12 or higher

    import {

    to = cloudfoundry_service_instance_sharing.<resource_name>

    identity = {

    service_instance_guid = “<service_instance_guid>”

    }

    }

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

    Package Details

    Repository
    cloudfoundry cloudfoundry/terraform-provider-cloudfoundry
    License
    Notes
    This Pulumi package is based on the cloudfoundry Terraform Provider.
    cloudfoundry
    Viewing docs for cloudfoundry 1.19.0
    published on Friday, Nov 13, 2026 by cloudfoundry

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial