published on Friday, Nov 13, 2026 by cloudfoundry
published on Friday, Nov 13, 2026 by cloudfoundry
Provides a Cloud Foundry resource for assigning space roles. For a user to be assigned a space role, the user must already have the organization_user role.(Updating a role is not supported according to the docs)
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as cloudfoundry from "@pulumi/cloudfoundry";
const myRole = new cloudfoundry.SpaceRole("my_role", {
username: "test123@example.com",
type: "space_manager",
space: "dd457c79-f7c9-4828-862b-35843d3b646d",
});
import pulumi
import pulumi_cloudfoundry as cloudfoundry
my_role = cloudfoundry.SpaceRole("my_role",
username="test123@example.com",
type="space_manager",
space="dd457c79-f7c9-4828-862b-35843d3b646d")
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.NewSpaceRole(ctx, "my_role", &cloudfoundry.SpaceRoleArgs{
Username: pulumi.String("test123@example.com"),
Type: pulumi.String("space_manager"),
Space: pulumi.String("dd457c79-f7c9-4828-862b-35843d3b646d"),
})
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 myRole = new Cloudfoundry.SpaceRole("my_role", new()
{
Username = "test123@example.com",
Type = "space_manager",
Space = "dd457c79-f7c9-4828-862b-35843d3b646d",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudfoundry.SpaceRole;
import com.pulumi.cloudfoundry.SpaceRoleArgs;
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 myRole = new SpaceRole("myRole", SpaceRoleArgs.builder()
.username("test123@example.com")
.type("space_manager")
.space("dd457c79-f7c9-4828-862b-35843d3b646d")
.build());
}
}
resources:
myRole:
type: cloudfoundry:SpaceRole
name: my_role
properties:
username: test123@example.com
type: space_manager
space: dd457c79-f7c9-4828-862b-35843d3b646d
Example coming soon!
Create SpaceRole Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new SpaceRole(name: string, args: SpaceRoleArgs, opts?: CustomResourceOptions);@overload
def SpaceRole(resource_name: str,
args: SpaceRoleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def SpaceRole(resource_name: str,
opts: Optional[ResourceOptions] = None,
space: Optional[str] = None,
type: Optional[str] = None,
origin: Optional[str] = None,
user: Optional[str] = None,
username: Optional[str] = None)func NewSpaceRole(ctx *Context, name string, args SpaceRoleArgs, opts ...ResourceOption) (*SpaceRole, error)public SpaceRole(string name, SpaceRoleArgs args, CustomResourceOptions? opts = null)
public SpaceRole(String name, SpaceRoleArgs args)
public SpaceRole(String name, SpaceRoleArgs args, CustomResourceOptions options)
type: cloudfoundry:SpaceRole
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "cloudfoundry_space_role" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args SpaceRoleArgs
- 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 SpaceRoleArgs
- 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 SpaceRoleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SpaceRoleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SpaceRoleArgs
- 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 spaceRoleResource = new Cloudfoundry.SpaceRole("spaceRoleResource", new()
{
Space = "string",
Type = "string",
Origin = "string",
User = "string",
Username = "string",
});
example, err := cloudfoundry.NewSpaceRole(ctx, "spaceRoleResource", &cloudfoundry.SpaceRoleArgs{
Space: pulumi.String("string"),
Type: pulumi.String("string"),
Origin: pulumi.String("string"),
User: pulumi.String("string"),
Username: pulumi.String("string"),
})
resource "cloudfoundry_space_role" "spaceRoleResource" {
lifecycle {
create_before_destroy = true
}
space = "string"
type = "string"
origin = "string"
user = "string"
username = "string"
}
var spaceRoleResource = new SpaceRole("spaceRoleResource", SpaceRoleArgs.builder()
.space("string")
.type("string")
.origin("string")
.user("string")
.username("string")
.build());
space_role_resource = cloudfoundry.SpaceRole("spaceRoleResource",
space="string",
type="string",
origin="string",
user="string",
username="string")
const spaceRoleResource = new cloudfoundry.SpaceRole("spaceRoleResource", {
space: "string",
type: "string",
origin: "string",
user: "string",
username: "string",
});
type: cloudfoundry:SpaceRole
properties:
origin: string
space: string
type: string
user: string
username: string
SpaceRole 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 SpaceRole resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the SpaceRole resource produces the following output properties:
- created_
at string - The date and time when the resource was created in RFC3339 format.
- id string
- The provider-assigned unique ID for this managed resource.
- updated_
at string - The date and time when the resource was updated in RFC3339 format.
- created_
at str - The date and time when the resource was created in RFC3339 format.
- id str
- The provider-assigned unique ID for this managed resource.
- updated_
at str - The date and time when the resource was updated in RFC3339 format.
Look up Existing SpaceRole Resource
Get an existing SpaceRole 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?: SpaceRoleState, opts?: CustomResourceOptions): SpaceRole@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
created_at: Optional[str] = None,
origin: Optional[str] = None,
space: Optional[str] = None,
type: Optional[str] = None,
updated_at: Optional[str] = None,
user: Optional[str] = None,
username: Optional[str] = None) -> SpaceRolefunc GetSpaceRole(ctx *Context, name string, id IDInput, state *SpaceRoleState, opts ...ResourceOption) (*SpaceRole, error)public static SpaceRole Get(string name, Input<string> id, SpaceRoleState? state, CustomResourceOptions? opts = null)public static SpaceRole get(String name, Output<String> id, SpaceRoleState state, CustomResourceOptions options)resources: existingSpaceRole: type: cloudfoundry:SpaceRole get: id: ${id}import {
to = cloudfoundry_space_role.example
id = "${id}"
}
- name string
- The unique name of the resulting resource.
- id Input<ID>
- The unique provider ID of the resource to look up.
- state SpaceRoleState
- Known property values the provider needs, along with the ID, to find the resource. Usually not required.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resulting resource.
- id str
- The unique provider ID of the resource to look up.
- 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 resulting resource.
- id IDInput
- The unique provider ID of the resource to look up.
- state SpaceRoleState
- Known property values the provider needs, along with the ID, to find the resource. Usually not required.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resulting resource.
- id Input<string>
- The unique provider ID of the resource to look up.
- state SpaceRoleState
- Known property values the provider needs, along with the ID, to find the resource. Usually not required.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resulting resource.
- id Output<String>
- The unique provider ID of the resource to look up.
- state SpaceRoleState
- Known property values the provider needs, along with the ID, to find the resource. Usually not required.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
- Created
At string - The date and time when the resource was created in RFC3339 format.
- Origin string
- The identity provider for the UAA user
- Space string
- The guid of the space to assign the role to
- Type string
- Role type; see Valid role types
- Updated
At string - The date and time when the resource was updated in RFC3339 format.
- User string
- The guid of the cloudfoundry user to assign the role with
- Username string
- The username of the cloudfoundry user to assign the role with
- Created
At string - The date and time when the resource was created in RFC3339 format.
- Origin string
- The identity provider for the UAA user
- Space string
- The guid of the space to assign the role to
- Type string
- Role type; see Valid role types
- Updated
At string - The date and time when the resource was updated in RFC3339 format.
- User string
- The guid of the cloudfoundry user to assign the role with
- Username string
- The username of the cloudfoundry user to assign the role with
- created_
at string - The date and time when the resource was created in RFC3339 format.
- origin string
- The identity provider for the UAA user
- space string
- The guid of the space to assign the role to
- type string
- Role type; see Valid role types
- updated_
at string - The date and time when the resource was updated in RFC3339 format.
- user string
- The guid of the cloudfoundry user to assign the role with
- username string
- The username of the cloudfoundry user to assign the role with
- created
At String - The date and time when the resource was created in RFC3339 format.
- origin String
- The identity provider for the UAA user
- space String
- The guid of the space to assign the role to
- type String
- Role type; see Valid role types
- updated
At String - The date and time when the resource was updated in RFC3339 format.
- user String
- The guid of the cloudfoundry user to assign the role with
- username String
- The username of the cloudfoundry user to assign the role with
- created
At string - The date and time when the resource was created in RFC3339 format.
- origin string
- The identity provider for the UAA user
- space string
- The guid of the space to assign the role to
- type string
- Role type; see Valid role types
- updated
At string - The date and time when the resource was updated in RFC3339 format.
- user string
- The guid of the cloudfoundry user to assign the role with
- username string
- The username of the cloudfoundry user to assign the role with
- created_
at str - The date and time when the resource was created in RFC3339 format.
- origin str
- The identity provider for the UAA user
- space str
- The guid of the space to assign the role to
- type str
- Role type; see Valid role types
- updated_
at str - The date and time when the resource was updated in RFC3339 format.
- user str
- The guid of the cloudfoundry user to assign the role with
- username str
- The username of the cloudfoundry user to assign the role with
- created
At String - The date and time when the resource was created in RFC3339 format.
- origin String
- The identity provider for the UAA user
- space String
- The guid of the space to assign the role to
- type String
- Role type; see Valid role types
- updated
At String - The date and time when the resource was updated in RFC3339 format.
- user String
- The guid of the cloudfoundry user to assign the role with
- username String
- The username of the cloudfoundry user to assign the role with
Import
terraform
$ pulumi import cloudfoundry:index/spaceRole:SpaceRole <resource_name> <role_guid>
$ pulumi import cloudfoundry:index/spaceRole:SpaceRole my_role 8f5b7b45-83f4-41c1-b99e-0f9582c31209
$ pulumi import cloudfoundry:index/spaceRole:SpaceRole #using id attribute in import block
import {
to = cloudfoundry_space_role.<resource_name>
id = “<role_guid>”
}
this resource supports import using identity attribute from Terraform version 1.12 or higher
import {
to = cloudfoundry_space_role.<resource_name>
identity = {
role_guid = “<role_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
cloudfoundryTerraform Provider.
published on Friday, Nov 13, 2026 by cloudfoundry