cloudfoundry.ServiceKey
Explore with Pulumi AI
Provides a Cloud Foundry resource for managing Cloud Foundry Service Keys.
Example Usage
The following creates a Service Key for the referenced Service Instance.
import * as pulumi from "@pulumi/pulumi";
import * as cloudfoundry from "@pulumi/cloudfoundry";
const redis = cloudfoundry.getService({
name: "p-redis",
});
const redis1 = new cloudfoundry.ServiceInstance("redis1", {
space: cloudfoundry_space.dev.id,
servicePlan: redis.then(redis => redis.servicePlans?.["shared-vm"]),
});
const redis1_key1 = new cloudfoundry.ServiceKey("redis1-key1", {serviceInstance: redis1.serviceInstanceId});
import pulumi
import pulumi_cloudfoundry as cloudfoundry
redis = cloudfoundry.get_service(name="p-redis")
redis1 = cloudfoundry.ServiceInstance("redis1",
space=cloudfoundry_space["dev"]["id"],
service_plan=redis.service_plans["shared-vm"])
redis1_key1 = cloudfoundry.ServiceKey("redis1-key1", service_instance=redis1.service_instance_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 {
redis, err := cloudfoundry.GetService(ctx, &cloudfoundry.GetServiceArgs{
Name: "p-redis",
}, nil)
if err != nil {
return err
}
redis1, err := cloudfoundry.NewServiceInstance(ctx, "redis1", &cloudfoundry.ServiceInstanceArgs{
Space: pulumi.Any(cloudfoundry_space.Dev.Id),
ServicePlan: pulumi.String(redis.ServicePlans.SharedVm),
})
if err != nil {
return err
}
_, err = cloudfoundry.NewServiceKey(ctx, "redis1-key1", &cloudfoundry.ServiceKeyArgs{
ServiceInstance: redis1.ServiceInstanceId,
})
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 redis = Cloudfoundry.GetService.Invoke(new()
{
Name = "p-redis",
});
var redis1 = new Cloudfoundry.ServiceInstance("redis1", new()
{
Space = cloudfoundry_space.Dev.Id,
ServicePlan = redis.Apply(getServiceResult => getServiceResult.ServicePlans?.Shared_vm),
});
var redis1_key1 = new Cloudfoundry.ServiceKey("redis1-key1", new()
{
ServiceInstance = redis1.ServiceInstanceId,
});
});
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 com.pulumi.cloudfoundry.ServiceInstance;
import com.pulumi.cloudfoundry.ServiceInstanceArgs;
import com.pulumi.cloudfoundry.ServiceKey;
import com.pulumi.cloudfoundry.ServiceKeyArgs;
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());
var redis1 = new ServiceInstance("redis1", ServiceInstanceArgs.builder()
.space(cloudfoundry_space.dev().id())
.servicePlan(redis.applyValue(getServiceResult -> getServiceResult.servicePlans().shared-vm()))
.build());
var redis1_key1 = new ServiceKey("redis1-key1", ServiceKeyArgs.builder()
.serviceInstance(redis1.serviceInstanceId())
.build());
}
}
resources:
redis1:
type: cloudfoundry:ServiceInstance
properties:
space: ${cloudfoundry_space.dev.id}
servicePlan: ${redis.servicePlans"shared-vm"[%!s(MISSING)]}
redis1-key1:
type: cloudfoundry:ServiceKey
properties:
serviceInstance: ${redis1.serviceInstanceId}
variables:
redis:
fn::invoke:
function: cloudfoundry:getService
arguments:
name: p-redis
Create ServiceKey Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ServiceKey(name: string, args: ServiceKeyArgs, opts?: CustomResourceOptions);
@overload
def ServiceKey(resource_name: str,
args: ServiceKeyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ServiceKey(resource_name: str,
opts: Optional[ResourceOptions] = None,
service_instance: Optional[str] = None,
name: Optional[str] = None,
params: Optional[Mapping[str, str]] = None,
params_json: Optional[str] = None,
service_key_id: Optional[str] = None,
timeouts: Optional[ServiceKeyTimeoutsArgs] = None)
func NewServiceKey(ctx *Context, name string, args ServiceKeyArgs, opts ...ResourceOption) (*ServiceKey, error)
public ServiceKey(string name, ServiceKeyArgs args, CustomResourceOptions? opts = null)
public ServiceKey(String name, ServiceKeyArgs args)
public ServiceKey(String name, ServiceKeyArgs args, CustomResourceOptions options)
type: cloudfoundry:ServiceKey
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 ServiceKeyArgs
- 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 ServiceKeyArgs
- 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 ServiceKeyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ServiceKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ServiceKeyArgs
- 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 serviceKeyResource = new Cloudfoundry.ServiceKey("serviceKeyResource", new()
{
ServiceInstance = "string",
Name = "string",
Params =
{
{ "string", "string" },
},
ParamsJson = "string",
ServiceKeyId = "string",
Timeouts = new Cloudfoundry.Inputs.ServiceKeyTimeoutsArgs
{
Create = "string",
Delete = "string",
},
});
example, err := cloudfoundry.NewServiceKey(ctx, "serviceKeyResource", &cloudfoundry.ServiceKeyArgs{
ServiceInstance: pulumi.String("string"),
Name: pulumi.String("string"),
Params: pulumi.StringMap{
"string": pulumi.String("string"),
},
ParamsJson: pulumi.String("string"),
ServiceKeyId: pulumi.String("string"),
Timeouts: &cloudfoundry.ServiceKeyTimeoutsArgs{
Create: pulumi.String("string"),
Delete: pulumi.String("string"),
},
})
var serviceKeyResource = new ServiceKey("serviceKeyResource", ServiceKeyArgs.builder()
.serviceInstance("string")
.name("string")
.params(Map.of("string", "string"))
.paramsJson("string")
.serviceKeyId("string")
.timeouts(ServiceKeyTimeoutsArgs.builder()
.create("string")
.delete("string")
.build())
.build());
service_key_resource = cloudfoundry.ServiceKey("serviceKeyResource",
service_instance="string",
name="string",
params={
"string": "string",
},
params_json="string",
service_key_id="string",
timeouts={
"create": "string",
"delete": "string",
})
const serviceKeyResource = new cloudfoundry.ServiceKey("serviceKeyResource", {
serviceInstance: "string",
name: "string",
params: {
string: "string",
},
paramsJson: "string",
serviceKeyId: "string",
timeouts: {
create: "string",
"delete": "string",
},
});
type: cloudfoundry:ServiceKey
properties:
name: string
params:
string: string
paramsJson: string
serviceInstance: string
serviceKeyId: string
timeouts:
create: string
delete: string
ServiceKey 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 ServiceKey resource accepts the following input properties:
- Service
Instance string - The ID of the Service Instance the key should be associated with.
- Name string
- The name of the Service Key in Cloud Foundry.
- Params Dictionary<string, string>
- A list of key/value parameters used by the service broker to create the binding for the key. By default, no parameters are provided.
- Params
Json string - Arbitrary parameters in the form of stringified JSON object to pass to the service bind handler.
- Service
Key stringId - The GUID of the service instance.
- Timeouts
Service
Key Timeouts
- Service
Instance string - The ID of the Service Instance the key should be associated with.
- Name string
- The name of the Service Key in Cloud Foundry.
- Params map[string]string
- A list of key/value parameters used by the service broker to create the binding for the key. By default, no parameters are provided.
- Params
Json string - Arbitrary parameters in the form of stringified JSON object to pass to the service bind handler.
- Service
Key stringId - The GUID of the service instance.
- Timeouts
Service
Key Timeouts Args
- service
Instance String - The ID of the Service Instance the key should be associated with.
- name String
- The name of the Service Key in Cloud Foundry.
- params Map<String,String>
- A list of key/value parameters used by the service broker to create the binding for the key. By default, no parameters are provided.
- params
Json String - Arbitrary parameters in the form of stringified JSON object to pass to the service bind handler.
- service
Key StringId - The GUID of the service instance.
- timeouts
Service
Key Timeouts
- service
Instance string - The ID of the Service Instance the key should be associated with.
- name string
- The name of the Service Key in Cloud Foundry.
- params {[key: string]: string}
- A list of key/value parameters used by the service broker to create the binding for the key. By default, no parameters are provided.
- params
Json string - Arbitrary parameters in the form of stringified JSON object to pass to the service bind handler.
- service
Key stringId - The GUID of the service instance.
- timeouts
Service
Key Timeouts
- service_
instance str - The ID of the Service Instance the key should be associated with.
- name str
- The name of the Service Key in Cloud Foundry.
- params Mapping[str, str]
- A list of key/value parameters used by the service broker to create the binding for the key. By default, no parameters are provided.
- params_
json str - Arbitrary parameters in the form of stringified JSON object to pass to the service bind handler.
- service_
key_ strid - The GUID of the service instance.
- timeouts
Service
Key Timeouts Args
- service
Instance String - The ID of the Service Instance the key should be associated with.
- name String
- The name of the Service Key in Cloud Foundry.
- params Map<String>
- A list of key/value parameters used by the service broker to create the binding for the key. By default, no parameters are provided.
- params
Json String - Arbitrary parameters in the form of stringified JSON object to pass to the service bind handler.
- service
Key StringId - The GUID of the service instance.
- timeouts Property Map
Outputs
All input properties are implicitly available as output properties. Additionally, the ServiceKey resource produces the following output properties:
- Credentials Dictionary<string, string>
- Credentials for this service key that can be used to bind to the associated service instance.
- Id string
- The provider-assigned unique ID for this managed resource.
- Credentials map[string]string
- Credentials for this service key that can be used to bind to the associated service instance.
- Id string
- The provider-assigned unique ID for this managed resource.
- credentials Map<String,String>
- Credentials for this service key that can be used to bind to the associated service instance.
- id String
- The provider-assigned unique ID for this managed resource.
- credentials {[key: string]: string}
- Credentials for this service key that can be used to bind to the associated service instance.
- id string
- The provider-assigned unique ID for this managed resource.
- credentials Mapping[str, str]
- Credentials for this service key that can be used to bind to the associated service instance.
- id str
- The provider-assigned unique ID for this managed resource.
- credentials Map<String>
- Credentials for this service key that can be used to bind to the associated service instance.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing ServiceKey Resource
Get an existing ServiceKey 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?: ServiceKeyState, opts?: CustomResourceOptions): ServiceKey
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
credentials: Optional[Mapping[str, str]] = None,
name: Optional[str] = None,
params: Optional[Mapping[str, str]] = None,
params_json: Optional[str] = None,
service_instance: Optional[str] = None,
service_key_id: Optional[str] = None,
timeouts: Optional[ServiceKeyTimeoutsArgs] = None) -> ServiceKey
func GetServiceKey(ctx *Context, name string, id IDInput, state *ServiceKeyState, opts ...ResourceOption) (*ServiceKey, error)
public static ServiceKey Get(string name, Input<string> id, ServiceKeyState? state, CustomResourceOptions? opts = null)
public static ServiceKey get(String name, Output<String> id, ServiceKeyState state, CustomResourceOptions options)
resources: _: type: cloudfoundry:ServiceKey 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.
- Credentials Dictionary<string, string>
- Credentials for this service key that can be used to bind to the associated service instance.
- Name string
- The name of the Service Key in Cloud Foundry.
- Params Dictionary<string, string>
- A list of key/value parameters used by the service broker to create the binding for the key. By default, no parameters are provided.
- Params
Json string - Arbitrary parameters in the form of stringified JSON object to pass to the service bind handler.
- Service
Instance string - The ID of the Service Instance the key should be associated with.
- Service
Key stringId - The GUID of the service instance.
- Timeouts
Service
Key Timeouts
- Credentials map[string]string
- Credentials for this service key that can be used to bind to the associated service instance.
- Name string
- The name of the Service Key in Cloud Foundry.
- Params map[string]string
- A list of key/value parameters used by the service broker to create the binding for the key. By default, no parameters are provided.
- Params
Json string - Arbitrary parameters in the form of stringified JSON object to pass to the service bind handler.
- Service
Instance string - The ID of the Service Instance the key should be associated with.
- Service
Key stringId - The GUID of the service instance.
- Timeouts
Service
Key Timeouts Args
- credentials Map<String,String>
- Credentials for this service key that can be used to bind to the associated service instance.
- name String
- The name of the Service Key in Cloud Foundry.
- params Map<String,String>
- A list of key/value parameters used by the service broker to create the binding for the key. By default, no parameters are provided.
- params
Json String - Arbitrary parameters in the form of stringified JSON object to pass to the service bind handler.
- service
Instance String - The ID of the Service Instance the key should be associated with.
- service
Key StringId - The GUID of the service instance.
- timeouts
Service
Key Timeouts
- credentials {[key: string]: string}
- Credentials for this service key that can be used to bind to the associated service instance.
- name string
- The name of the Service Key in Cloud Foundry.
- params {[key: string]: string}
- A list of key/value parameters used by the service broker to create the binding for the key. By default, no parameters are provided.
- params
Json string - Arbitrary parameters in the form of stringified JSON object to pass to the service bind handler.
- service
Instance string - The ID of the Service Instance the key should be associated with.
- service
Key stringId - The GUID of the service instance.
- timeouts
Service
Key Timeouts
- credentials Mapping[str, str]
- Credentials for this service key that can be used to bind to the associated service instance.
- name str
- The name of the Service Key in Cloud Foundry.
- params Mapping[str, str]
- A list of key/value parameters used by the service broker to create the binding for the key. By default, no parameters are provided.
- params_
json str - Arbitrary parameters in the form of stringified JSON object to pass to the service bind handler.
- service_
instance str - The ID of the Service Instance the key should be associated with.
- service_
key_ strid - The GUID of the service instance.
- timeouts
Service
Key Timeouts Args
- credentials Map<String>
- Credentials for this service key that can be used to bind to the associated service instance.
- name String
- The name of the Service Key in Cloud Foundry.
- params Map<String>
- A list of key/value parameters used by the service broker to create the binding for the key. By default, no parameters are provided.
- params
Json String - Arbitrary parameters in the form of stringified JSON object to pass to the service bind handler.
- service
Instance String - The ID of the Service Instance the key should be associated with.
- service
Key StringId - The GUID of the service instance.
- timeouts Property Map
Supporting Types
ServiceKeyTimeouts, ServiceKeyTimeoutsArgs
Import
Timeouts
cloudfoundry_service_key
provides the following
Timeouts configuration options:
create
- (Default60 seconds
) Used for Creating Instance.delete
- (Default60 seconds
) Used for Destroying Instance.
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.