1. Packages
  2. CockroachDB Cloud
  3. API Docs
  4. ServiceAccount
CockroachDB v0.9.0 published on Tuesday, Dec 17, 2024 by pulumiverse

cockroach.ServiceAccount

Explore with Pulumi AI

CockroachDB Cloud service account. A service account represents a non-person user. By default a service account has no access but it can be accompanied by either a cockroach.UserRoleGrants resource or any number of cockroach.UserRoleGrant resources to grant it roles.

Example Usage

Coming soon!
Coming soon!
Coming soon!
Coming soon!
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cockroach.ServiceAccount;
import com.pulumi.cockroach.ServiceAccountArgs;
import com.pulumi.cockroach.UserRoleGrants;
import com.pulumi.cockroach.UserRoleGrantsArgs;
import com.pulumi.cockroach.inputs.UserRoleGrantsRoleArgs;
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 prodSa = new ServiceAccount("prodSa", ServiceAccountArgs.builder()
            .name("Prod cluster SA")
            .description("A service account used for managing access to the prod cluster")
            .build());

        var prodSaUserRoleGrants = new UserRoleGrants("prodSaUserRoleGrants", UserRoleGrantsArgs.builder()
            .userId(prodSa.id())
            .roles(UserRoleGrantsRoleArgs.builder()
                .role_name("CLUSTER_ADMIN")
                .resource_type("CLUSTER")
                .resource_id(prod.id())
                .build())
            .build());

    }
}
Copy
resources:
  prodSa:
    type: cockroach:ServiceAccount
    name: prod_sa
    properties:
      name: Prod cluster SA
      description: A service account used for managing access to the prod cluster
  prodSaUserRoleGrants:
    type: cockroach:UserRoleGrants
    name: prod_sa
    properties:
      userId: ${prodSa.id}
      roles:
        - role_name: CLUSTER_ADMIN
          resource_type: CLUSTER
          resource_id: ${prod.id}
Copy

Create ServiceAccount Resource

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

Constructor syntax

new ServiceAccount(name: string, args?: ServiceAccountArgs, opts?: CustomResourceOptions);
@overload
def ServiceAccount(resource_name: str,
                   args: Optional[ServiceAccountArgs] = None,
                   opts: Optional[ResourceOptions] = None)

@overload
def ServiceAccount(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   description: Optional[str] = None,
                   name: Optional[str] = None)
func NewServiceAccount(ctx *Context, name string, args *ServiceAccountArgs, opts ...ResourceOption) (*ServiceAccount, error)
public ServiceAccount(string name, ServiceAccountArgs? args = null, CustomResourceOptions? opts = null)
public ServiceAccount(String name, ServiceAccountArgs args)
public ServiceAccount(String name, ServiceAccountArgs args, CustomResourceOptions options)
type: cockroach:ServiceAccount
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args ServiceAccountArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args ServiceAccountArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args ServiceAccountArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args ServiceAccountArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ServiceAccountArgs
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 serviceAccountResource = new Cockroach.ServiceAccount("serviceAccountResource", new()
{
    Description = "string",
    Name = "string",
});
Copy
example, err := cockroach.NewServiceAccount(ctx, "serviceAccountResource", &cockroach.ServiceAccountArgs{
	Description: pulumi.String("string"),
	Name:        pulumi.String("string"),
})
Copy
var serviceAccountResource = new ServiceAccount("serviceAccountResource", ServiceAccountArgs.builder()
    .description("string")
    .name("string")
    .build());
Copy
service_account_resource = cockroach.ServiceAccount("serviceAccountResource",
    description="string",
    name="string")
Copy
const serviceAccountResource = new cockroach.ServiceAccount("serviceAccountResource", {
    description: "string",
    name: "string",
});
Copy
type: cockroach:ServiceAccount
properties:
    description: string
    name: string
Copy

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

Description string
Description of the service account.
Name string
Name of the service account.
Description string
Description of the service account.
Name string
Name of the service account.
description String
Description of the service account.
name String
Name of the service account.
description string
Description of the service account.
name string
Name of the service account.
description str
Description of the service account.
name str
Name of the service account.
description String
Description of the service account.
name String
Name of the service account.

Outputs

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

CreatedAt string
Creation time of the service account.
CreatorName string
Name of the creator of the service account.
Id string
The provider-assigned unique ID for this managed resource.
CreatedAt string
Creation time of the service account.
CreatorName string
Name of the creator of the service account.
Id string
The provider-assigned unique ID for this managed resource.
createdAt String
Creation time of the service account.
creatorName String
Name of the creator of the service account.
id String
The provider-assigned unique ID for this managed resource.
createdAt string
Creation time of the service account.
creatorName string
Name of the creator of the service account.
id string
The provider-assigned unique ID for this managed resource.
created_at str
Creation time of the service account.
creator_name str
Name of the creator of the service account.
id str
The provider-assigned unique ID for this managed resource.
createdAt String
Creation time of the service account.
creatorName String
Name of the creator of the service account.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing ServiceAccount Resource

Get an existing ServiceAccount 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?: ServiceAccountState, opts?: CustomResourceOptions): ServiceAccount
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        created_at: Optional[str] = None,
        creator_name: Optional[str] = None,
        description: Optional[str] = None,
        name: Optional[str] = None) -> ServiceAccount
func GetServiceAccount(ctx *Context, name string, id IDInput, state *ServiceAccountState, opts ...ResourceOption) (*ServiceAccount, error)
public static ServiceAccount Get(string name, Input<string> id, ServiceAccountState? state, CustomResourceOptions? opts = null)
public static ServiceAccount get(String name, Output<String> id, ServiceAccountState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
CreatedAt string
Creation time of the service account.
CreatorName string
Name of the creator of the service account.
Description string
Description of the service account.
Name string
Name of the service account.
CreatedAt string
Creation time of the service account.
CreatorName string
Name of the creator of the service account.
Description string
Description of the service account.
Name string
Name of the service account.
createdAt String
Creation time of the service account.
creatorName String
Name of the creator of the service account.
description String
Description of the service account.
name String
Name of the service account.
createdAt string
Creation time of the service account.
creatorName string
Name of the creator of the service account.
description string
Description of the service account.
name string
Name of the service account.
created_at str
Creation time of the service account.
creator_name str
Name of the creator of the service account.
description str
Description of the service account.
name str
Name of the service account.
createdAt String
Creation time of the service account.
creatorName String
Name of the creator of the service account.
description String
Description of the service account.
name String
Name of the service account.

Import

format

$ pulumi import cockroach:index/serviceAccount:ServiceAccount api_service_account 1f69fdd2-600a-4cfc-a9ba-16995df0d77d
Copy

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

Package Details

Repository
cockroach pulumiverse/pulumi-cockroach
License
Apache-2.0
Notes
This Pulumi package is based on the cockroach Terraform Provider.