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

cloudfoundry.ServiceInstanceSharing

Explore with Pulumi AI

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

    Sharing a service instance to another space Sharing Service Instances within spaces.

    Example Usage

    The following example shares a specific service instance to the given space.

    import * as pulumi from "@pulumi/pulumi";
    import * as cloudfoundry from "@pulumi/cloudfoundry";
    
    const my_redis = cloudfoundry.getServiceInstance({
        nameOrId: "my-redis",
        space: cloudfoundry_space["dev-1"].id,
    });
    const share_to_dev_2 = new cloudfoundry.ServiceInstanceSharing("share-to-dev-2", {
        serviceInstanceId: my_redis.then(my_redis => my_redis.id),
        spaceId: cloudfoundry_space["dev-2"].id,
    });
    
    import pulumi
    import pulumi_cloudfoundry as cloudfoundry
    
    my_redis = cloudfoundry.get_service_instance(name_or_id="my-redis",
        space=cloudfoundry_space["dev-1"]["id"])
    share_to_dev_2 = cloudfoundry.ServiceInstanceSharing("share-to-dev-2",
        service_instance_id=my_redis.id,
        space_id=cloudfoundry_space["dev-2"]["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_redis, err := cloudfoundry.LookupServiceInstance(ctx, &cloudfoundry.LookupServiceInstanceArgs{
    			NameOrId: "my-redis",
    			Space:    cloudfoundry_space.Dev1.Id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = cloudfoundry.NewServiceInstanceSharing(ctx, "share-to-dev-2", &cloudfoundry.ServiceInstanceSharingArgs{
    			ServiceInstanceId: pulumi.String(my_redis.Id),
    			SpaceId:           pulumi.Any(cloudfoundry_space.Dev2.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_redis = Cloudfoundry.GetServiceInstance.Invoke(new()
        {
            NameOrId = "my-redis",
            Space = cloudfoundry_space.Dev_1.Id,
        });
    
        var share_to_dev_2 = new Cloudfoundry.ServiceInstanceSharing("share-to-dev-2", new()
        {
            ServiceInstanceId = my_redis.Apply(my_redis => my_redis.Apply(getServiceInstanceResult => getServiceInstanceResult.Id)),
            SpaceId = cloudfoundry_space.Dev_2.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.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-redis = CloudfoundryFunctions.getServiceInstance(GetServiceInstanceArgs.builder()
                .nameOrId("my-redis")
                .space(cloudfoundry_space.dev-1().id())
                .build());
    
            var share_to_dev_2 = new ServiceInstanceSharing("share-to-dev-2", ServiceInstanceSharingArgs.builder()
                .serviceInstanceId(my_redis.id())
                .spaceId(cloudfoundry_space.dev-2().id())
                .build());
    
        }
    }
    
    resources:
      share-to-dev-2:
        type: cloudfoundry:ServiceInstanceSharing
        properties:
          serviceInstanceId: ${["my-redis"].id}
          spaceId: ${cloudfoundry_space"dev-2"[%!s(MISSING)].id}
    variables:
      my-redis:
        fn::invoke:
          function: cloudfoundry:getServiceInstance
          arguments:
            nameOrId: my-redis
            space: ${cloudfoundry_space"dev-1"[%!s(MISSING)].id}
    

    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_id: Optional[str] = None,
                               space_id: Optional[str] = None,
                               service_instance_sharing_id: Optional[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.
    
    

    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()
    {
        ServiceInstanceId = "string",
        SpaceId = "string",
        ServiceInstanceSharingId = "string",
    });
    
    example, err := cloudfoundry.NewServiceInstanceSharing(ctx, "serviceInstanceSharingResource", &cloudfoundry.ServiceInstanceSharingArgs{
    	ServiceInstanceId:        pulumi.String("string"),
    	SpaceId:                  pulumi.String("string"),
    	ServiceInstanceSharingId: pulumi.String("string"),
    })
    
    var serviceInstanceSharingResource = new ServiceInstanceSharing("serviceInstanceSharingResource", ServiceInstanceSharingArgs.builder()
        .serviceInstanceId("string")
        .spaceId("string")
        .serviceInstanceSharingId("string")
        .build());
    
    service_instance_sharing_resource = cloudfoundry.ServiceInstanceSharing("serviceInstanceSharingResource",
        service_instance_id="string",
        space_id="string",
        service_instance_sharing_id="string")
    
    const serviceInstanceSharingResource = new cloudfoundry.ServiceInstanceSharing("serviceInstanceSharingResource", {
        serviceInstanceId: "string",
        spaceId: "string",
        serviceInstanceSharingId: "string",
    });
    
    type: cloudfoundry:ServiceInstanceSharing
    properties:
        serviceInstanceId: string
        serviceInstanceSharingId: string
        spaceId: 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:

    ServiceInstanceId string
    The ID of the service instance to share.
    SpaceId string
    The ID of the space to share the service instance with, the space can be in the same or different org.
    ServiceInstanceSharingId string
    ServiceInstanceId string
    The ID of the service instance to share.
    SpaceId string
    The ID of the space to share the service instance with, the space can be in the same or different org.
    ServiceInstanceSharingId string
    serviceInstanceId String
    The ID of the service instance to share.
    spaceId String
    The ID of the space to share the service instance with, the space can be in the same or different org.
    serviceInstanceSharingId String
    serviceInstanceId string
    The ID of the service instance to share.
    spaceId string
    The ID of the space to share the service instance with, the space can be in the same or different org.
    serviceInstanceSharingId string
    service_instance_id str
    The ID of the service instance to share.
    space_id str
    The ID of the space to share the service instance with, the space can be in the same or different org.
    service_instance_sharing_id str
    serviceInstanceId String
    The ID of the service instance to share.
    spaceId String
    The ID of the space to share the service instance with, the space can be in the same or different org.
    serviceInstanceSharingId String

    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 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_id: Optional[str] = None,
            service_instance_sharing_id: Optional[str] = None,
            space_id: Optional[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}
    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:
    ServiceInstanceId string
    The ID of the service instance to share.
    ServiceInstanceSharingId string
    SpaceId string
    The ID of the space to share the service instance with, the space can be in the same or different org.
    ServiceInstanceId string
    The ID of the service instance to share.
    ServiceInstanceSharingId string
    SpaceId string
    The ID of the space to share the service instance with, the space can be in the same or different org.
    serviceInstanceId String
    The ID of the service instance to share.
    serviceInstanceSharingId String
    spaceId String
    The ID of the space to share the service instance with, the space can be in the same or different org.
    serviceInstanceId string
    The ID of the service instance to share.
    serviceInstanceSharingId string
    spaceId string
    The ID of the space to share the service instance with, the space can be in the same or different org.
    service_instance_id str
    The ID of the service instance to share.
    service_instance_sharing_id str
    space_id str
    The ID of the space to share the service instance with, the space can be in the same or different org.
    serviceInstanceId String
    The ID of the service instance to share.
    serviceInstanceSharingId String
    spaceId String
    The ID of the space to share the service instance with, the space can be in the same or different org.

    Import

    Existing Instance Shared can be imported using the composite id formed

    with service instance’s GUID and space’s GUID, seperated by a forward slash ‘/’.

    example: bb4ea411-service-instance-guid/820b9339-space-guid

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

    Package Details

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