confluentcloud.RoleBinding
Explore with Pulumi AI
confluentcloud.RoleBinding
provides a Role Binding resource that enables creating, reading, and deleting role bindings on Confluent Cloud.
Note: For more information on the Role Bindings, see Predefined RBAC roles in Confluent Cloud.
Example of using time_sleep
This configuration introduces a 360-second custom delay after the creation of a role binding, before creating a Kafka topic.
For context, using disable_wait_for_ready = false
(the default setting) results in a 90-second hardcoded delay, while opting for disable_wait_for_ready = true
results in a 0-second delay.
import * as pulumi from "@pulumi/pulumi";
import * as confluentcloud from "@pulumi/confluentcloud";
import * as time from "@pulumi/time";
const app_manager_kafka_cluster_admin_skip_sync = new confluentcloud.RoleBinding("app-manager-kafka-cluster-admin-skip-sync", {
principal: `User:${app_manager.id}`,
roleName: "CloudClusterAdmin",
crnPattern: standard.rbacCrn,
disableWaitForReady: true,
});
const wait360SecondsAfterRoleBinding = new time.index.Sleep("wait_360_seconds_after_role_binding", {createDuration: "360s"}, {
dependsOn: [app_manager_kafka_cluster_admin_skip_sync],
});
const orders = new confluentcloud.KafkaTopic("orders", {
kafkaCluster: {
id: standard.id,
},
topicName: "orders",
restEndpoint: standard.restEndpoint,
credentials: {
key: app_manager_kafka_api_key.id,
secret: app_manager_kafka_api_key.secret,
},
}, {
dependsOn: [wait360SecondsAfterRoleBinding],
});
import pulumi
import pulumi_confluentcloud as confluentcloud
import pulumi_time as time
app_manager_kafka_cluster_admin_skip_sync = confluentcloud.RoleBinding("app-manager-kafka-cluster-admin-skip-sync",
principal=f"User:{app_manager['id']}",
role_name="CloudClusterAdmin",
crn_pattern=standard["rbacCrn"],
disable_wait_for_ready=True)
wait360_seconds_after_role_binding = time.index.Sleep("wait_360_seconds_after_role_binding", create_duration=360s,
opts = pulumi.ResourceOptions(depends_on=[app_manager_kafka_cluster_admin_skip_sync]))
orders = confluentcloud.KafkaTopic("orders",
kafka_cluster={
"id": standard["id"],
},
topic_name="orders",
rest_endpoint=standard["restEndpoint"],
credentials={
"key": app_manager_kafka_api_key["id"],
"secret": app_manager_kafka_api_key["secret"],
},
opts = pulumi.ResourceOptions(depends_on=[wait360_seconds_after_role_binding]))
package main
import (
"fmt"
"github.com/pulumi/pulumi-confluentcloud/sdk/v2/go/confluentcloud"
"github.com/pulumi/pulumi-time/sdk/go/time"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
app_manager_kafka_cluster_admin_skip_sync, err := confluentcloud.NewRoleBinding(ctx, "app-manager-kafka-cluster-admin-skip-sync", &confluentcloud.RoleBindingArgs{
Principal: pulumi.Sprintf("User:%v", app_manager.Id),
RoleName: pulumi.String("CloudClusterAdmin"),
CrnPattern: pulumi.Any(standard.RbacCrn),
DisableWaitForReady: pulumi.Bool(true),
})
if err != nil {
return err
}
wait360SecondsAfterRoleBinding, err := time.NewSleep(ctx, "wait_360_seconds_after_role_binding", &time.SleepArgs{
CreateDuration: "360s",
}, pulumi.DependsOn([]pulumi.Resource{
app_manager_kafka_cluster_admin_skip_sync,
}))
if err != nil {
return err
}
_, err = confluentcloud.NewKafkaTopic(ctx, "orders", &confluentcloud.KafkaTopicArgs{
KafkaCluster: &confluentcloud.KafkaTopicKafkaClusterArgs{
Id: pulumi.Any(standard.Id),
},
TopicName: pulumi.String("orders"),
RestEndpoint: pulumi.Any(standard.RestEndpoint),
Credentials: &confluentcloud.KafkaTopicCredentialsArgs{
Key: pulumi.Any(app_manager_kafka_api_key.Id),
Secret: pulumi.Any(app_manager_kafka_api_key.Secret),
},
}, pulumi.DependsOn([]pulumi.Resource{
wait360SecondsAfterRoleBinding,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using ConfluentCloud = Pulumi.ConfluentCloud;
using Time = Pulumi.Time;
return await Deployment.RunAsync(() =>
{
var app_manager_kafka_cluster_admin_skip_sync = new ConfluentCloud.RoleBinding("app-manager-kafka-cluster-admin-skip-sync", new()
{
Principal = $"User:{app_manager.Id}",
RoleName = "CloudClusterAdmin",
CrnPattern = standard.RbacCrn,
DisableWaitForReady = true,
});
var wait360SecondsAfterRoleBinding = new Time.Index.Sleep("wait_360_seconds_after_role_binding", new()
{
CreateDuration = "360s",
}, new CustomResourceOptions
{
DependsOn =
{
app_manager_kafka_cluster_admin_skip_sync,
},
});
var orders = new ConfluentCloud.KafkaTopic("orders", new()
{
KafkaCluster = new ConfluentCloud.Inputs.KafkaTopicKafkaClusterArgs
{
Id = standard.Id,
},
TopicName = "orders",
RestEndpoint = standard.RestEndpoint,
Credentials = new ConfluentCloud.Inputs.KafkaTopicCredentialsArgs
{
Key = app_manager_kafka_api_key.Id,
Secret = app_manager_kafka_api_key.Secret,
},
}, new CustomResourceOptions
{
DependsOn =
{
wait360SecondsAfterRoleBinding,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.confluentcloud.RoleBinding;
import com.pulumi.confluentcloud.RoleBindingArgs;
import com.pulumi.time.sleep;
import com.pulumi.time.sleepArgs;
import com.pulumi.confluentcloud.KafkaTopic;
import com.pulumi.confluentcloud.KafkaTopicArgs;
import com.pulumi.confluentcloud.inputs.KafkaTopicKafkaClusterArgs;
import com.pulumi.confluentcloud.inputs.KafkaTopicCredentialsArgs;
import com.pulumi.resources.CustomResourceOptions;
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 app_manager_kafka_cluster_admin_skip_sync = new RoleBinding("app-manager-kafka-cluster-admin-skip-sync", RoleBindingArgs.builder()
.principal(String.format("User:%s", app_manager.id()))
.roleName("CloudClusterAdmin")
.crnPattern(standard.rbacCrn())
.disableWaitForReady(true)
.build());
var wait360SecondsAfterRoleBinding = new Sleep("wait360SecondsAfterRoleBinding", SleepArgs.builder()
.createDuration("360s")
.build(), CustomResourceOptions.builder()
.dependsOn(List.of(app_manager_kafka_cluster_admin_skip_sync))
.build());
var orders = new KafkaTopic("orders", KafkaTopicArgs.builder()
.kafkaCluster(KafkaTopicKafkaClusterArgs.builder()
.id(standard.id())
.build())
.topicName("orders")
.restEndpoint(standard.restEndpoint())
.credentials(KafkaTopicCredentialsArgs.builder()
.key(app_manager_kafka_api_key.id())
.secret(app_manager_kafka_api_key.secret())
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(wait360SecondsAfterRoleBinding)
.build());
}
}
resources:
app-manager-kafka-cluster-admin-skip-sync:
type: confluentcloud:RoleBinding
properties:
principal: User:${["app-manager"].id}
roleName: CloudClusterAdmin
crnPattern: ${standard.rbacCrn}
disableWaitForReady: true
wait360SecondsAfterRoleBinding:
type: time:sleep
name: wait_360_seconds_after_role_binding
properties:
createDuration: 360s
options:
dependsOn:
- ${["app-manager-kafka-cluster-admin-skip-sync"]}
orders:
type: confluentcloud:KafkaTopic
properties:
kafkaCluster:
id: ${standard.id}
topicName: orders
restEndpoint: ${standard.restEndpoint}
credentials:
key: ${["app-manager-kafka-api-key"].id}
secret: ${["app-manager-kafka-api-key"].secret}
options:
dependsOn:
- ${wait360SecondsAfterRoleBinding}
Create RoleBinding Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RoleBinding(name: string, args: RoleBindingArgs, opts?: CustomResourceOptions);
@overload
def RoleBinding(resource_name: str,
args: RoleBindingArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RoleBinding(resource_name: str,
opts: Optional[ResourceOptions] = None,
crn_pattern: Optional[str] = None,
principal: Optional[str] = None,
role_name: Optional[str] = None,
disable_wait_for_ready: Optional[bool] = None)
func NewRoleBinding(ctx *Context, name string, args RoleBindingArgs, opts ...ResourceOption) (*RoleBinding, error)
public RoleBinding(string name, RoleBindingArgs args, CustomResourceOptions? opts = null)
public RoleBinding(String name, RoleBindingArgs args)
public RoleBinding(String name, RoleBindingArgs args, CustomResourceOptions options)
type: confluentcloud:RoleBinding
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 RoleBindingArgs
- 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 RoleBindingArgs
- 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 RoleBindingArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RoleBindingArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RoleBindingArgs
- 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 roleBindingResource = new ConfluentCloud.RoleBinding("roleBindingResource", new()
{
CrnPattern = "string",
Principal = "string",
RoleName = "string",
DisableWaitForReady = false,
});
example, err := confluentcloud.NewRoleBinding(ctx, "roleBindingResource", &confluentcloud.RoleBindingArgs{
CrnPattern: pulumi.String("string"),
Principal: pulumi.String("string"),
RoleName: pulumi.String("string"),
DisableWaitForReady: pulumi.Bool(false),
})
var roleBindingResource = new RoleBinding("roleBindingResource", RoleBindingArgs.builder()
.crnPattern("string")
.principal("string")
.roleName("string")
.disableWaitForReady(false)
.build());
role_binding_resource = confluentcloud.RoleBinding("roleBindingResource",
crn_pattern="string",
principal="string",
role_name="string",
disable_wait_for_ready=False)
const roleBindingResource = new confluentcloud.RoleBinding("roleBindingResource", {
crnPattern: "string",
principal: "string",
roleName: "string",
disableWaitForReady: false,
});
type: confluentcloud:RoleBinding
properties:
crnPattern: string
disableWaitForReady: false
principal: string
roleName: string
RoleBinding 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 RoleBinding resource accepts the following input properties:
- Crn
Pattern string - A Confluent Resource Name (CRN) that specifies the scope and resource patterns necessary for the role to bind.
- Principal string
- A principal User to bind the role to, for example, "User:u-111aaa" for binding to a user "u-111aaa", or "User:sa-111aaa" for binding to a service account "sa-111aaa".
- Role
Name string - A name of the role to bind to the principal. See Confluent Cloud RBAC Roles for a full list of supported role names.
- Disable
Wait boolFor Ready
- Crn
Pattern string - A Confluent Resource Name (CRN) that specifies the scope and resource patterns necessary for the role to bind.
- Principal string
- A principal User to bind the role to, for example, "User:u-111aaa" for binding to a user "u-111aaa", or "User:sa-111aaa" for binding to a service account "sa-111aaa".
- Role
Name string - A name of the role to bind to the principal. See Confluent Cloud RBAC Roles for a full list of supported role names.
- Disable
Wait boolFor Ready
- crn
Pattern String - A Confluent Resource Name (CRN) that specifies the scope and resource patterns necessary for the role to bind.
- principal String
- A principal User to bind the role to, for example, "User:u-111aaa" for binding to a user "u-111aaa", or "User:sa-111aaa" for binding to a service account "sa-111aaa".
- role
Name String - A name of the role to bind to the principal. See Confluent Cloud RBAC Roles for a full list of supported role names.
- disable
Wait BooleanFor Ready
- crn
Pattern string - A Confluent Resource Name (CRN) that specifies the scope and resource patterns necessary for the role to bind.
- principal string
- A principal User to bind the role to, for example, "User:u-111aaa" for binding to a user "u-111aaa", or "User:sa-111aaa" for binding to a service account "sa-111aaa".
- role
Name string - A name of the role to bind to the principal. See Confluent Cloud RBAC Roles for a full list of supported role names.
- disable
Wait booleanFor Ready
- crn_
pattern str - A Confluent Resource Name (CRN) that specifies the scope and resource patterns necessary for the role to bind.
- principal str
- A principal User to bind the role to, for example, "User:u-111aaa" for binding to a user "u-111aaa", or "User:sa-111aaa" for binding to a service account "sa-111aaa".
- role_
name str - A name of the role to bind to the principal. See Confluent Cloud RBAC Roles for a full list of supported role names.
- disable_
wait_ boolfor_ ready
- crn
Pattern String - A Confluent Resource Name (CRN) that specifies the scope and resource patterns necessary for the role to bind.
- principal String
- A principal User to bind the role to, for example, "User:u-111aaa" for binding to a user "u-111aaa", or "User:sa-111aaa" for binding to a service account "sa-111aaa".
- role
Name String - A name of the role to bind to the principal. See Confluent Cloud RBAC Roles for a full list of supported role names.
- disable
Wait BooleanFor Ready
Outputs
All input properties are implicitly available as output properties. Additionally, the RoleBinding 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 RoleBinding Resource
Get an existing RoleBinding 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?: RoleBindingState, opts?: CustomResourceOptions): RoleBinding
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
crn_pattern: Optional[str] = None,
disable_wait_for_ready: Optional[bool] = None,
principal: Optional[str] = None,
role_name: Optional[str] = None) -> RoleBinding
func GetRoleBinding(ctx *Context, name string, id IDInput, state *RoleBindingState, opts ...ResourceOption) (*RoleBinding, error)
public static RoleBinding Get(string name, Input<string> id, RoleBindingState? state, CustomResourceOptions? opts = null)
public static RoleBinding get(String name, Output<String> id, RoleBindingState state, CustomResourceOptions options)
resources: _: type: confluentcloud:RoleBinding 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.
- Crn
Pattern string - A Confluent Resource Name (CRN) that specifies the scope and resource patterns necessary for the role to bind.
- Disable
Wait boolFor Ready - Principal string
- A principal User to bind the role to, for example, "User:u-111aaa" for binding to a user "u-111aaa", or "User:sa-111aaa" for binding to a service account "sa-111aaa".
- Role
Name string - A name of the role to bind to the principal. See Confluent Cloud RBAC Roles for a full list of supported role names.
- Crn
Pattern string - A Confluent Resource Name (CRN) that specifies the scope and resource patterns necessary for the role to bind.
- Disable
Wait boolFor Ready - Principal string
- A principal User to bind the role to, for example, "User:u-111aaa" for binding to a user "u-111aaa", or "User:sa-111aaa" for binding to a service account "sa-111aaa".
- Role
Name string - A name of the role to bind to the principal. See Confluent Cloud RBAC Roles for a full list of supported role names.
- crn
Pattern String - A Confluent Resource Name (CRN) that specifies the scope and resource patterns necessary for the role to bind.
- disable
Wait BooleanFor Ready - principal String
- A principal User to bind the role to, for example, "User:u-111aaa" for binding to a user "u-111aaa", or "User:sa-111aaa" for binding to a service account "sa-111aaa".
- role
Name String - A name of the role to bind to the principal. See Confluent Cloud RBAC Roles for a full list of supported role names.
- crn
Pattern string - A Confluent Resource Name (CRN) that specifies the scope and resource patterns necessary for the role to bind.
- disable
Wait booleanFor Ready - principal string
- A principal User to bind the role to, for example, "User:u-111aaa" for binding to a user "u-111aaa", or "User:sa-111aaa" for binding to a service account "sa-111aaa".
- role
Name string - A name of the role to bind to the principal. See Confluent Cloud RBAC Roles for a full list of supported role names.
- crn_
pattern str - A Confluent Resource Name (CRN) that specifies the scope and resource patterns necessary for the role to bind.
- disable_
wait_ boolfor_ ready - principal str
- A principal User to bind the role to, for example, "User:u-111aaa" for binding to a user "u-111aaa", or "User:sa-111aaa" for binding to a service account "sa-111aaa".
- role_
name str - A name of the role to bind to the principal. See Confluent Cloud RBAC Roles for a full list of supported role names.
- crn
Pattern String - A Confluent Resource Name (CRN) that specifies the scope and resource patterns necessary for the role to bind.
- disable
Wait BooleanFor Ready - principal String
- A principal User to bind the role to, for example, "User:u-111aaa" for binding to a user "u-111aaa", or "User:sa-111aaa" for binding to a service account "sa-111aaa".
- role
Name String - A name of the role to bind to the principal. See Confluent Cloud RBAC Roles for a full list of supported role names.
Import
You can import a Role Binding by using Role Binding ID, for example:
$ export CONFLUENT_CLOUD_API_KEY="<cloud_api_key>"
$ export CONFLUENT_CLOUD_API_SECRET="<cloud_api_secret>"
$ pulumi import confluentcloud:index/roleBinding:RoleBinding my_rb rb-f3a90de
!> Warning: Do not forget to delete terminal command history afterwards for security purposes.
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Confluent Cloud pulumi/pulumi-confluentcloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
confluent
Terraform Provider.