cockroach.ApiKey
Explore with Pulumi AI
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as cockroach from "@pulumiverse/cockroach";
const example = new cockroach.ApiKey("example", {
name: "An example api key",
serviceAccountId: exampleSa.id,
});
export const exampleSecret = example.secret;
import pulumi
import pulumiverse_cockroach as cockroach
example = cockroach.ApiKey("example",
name="An example api key",
service_account_id=example_sa["id"])
pulumi.export("exampleSecret", example.secret)
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-cockroach/sdk/go/cockroach"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := cockroach.NewApiKey(ctx, "example", &cockroach.ApiKeyArgs{
Name: pulumi.String("An example api key"),
ServiceAccountId: pulumi.Any(exampleSa.Id),
})
if err != nil {
return err
}
ctx.Export("exampleSecret", example.Secret)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cockroach = Pulumiverse.Cockroach;
return await Deployment.RunAsync(() =>
{
var example = new Cockroach.ApiKey("example", new()
{
Name = "An example api key",
ServiceAccountId = exampleSa.Id,
});
return new Dictionary<string, object?>
{
["exampleSecret"] = example.Secret,
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cockroach.ApiKey;
import com.pulumi.cockroach.ApiKeyArgs;
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 example = new ApiKey("example", ApiKeyArgs.builder()
.name("An example api key")
.serviceAccountId(exampleSa.id())
.build());
ctx.export("exampleSecret", example.secret());
}
}
resources:
example:
type: cockroach:ApiKey
properties:
name: An example api key
serviceAccountId: ${exampleSa.id}
outputs:
exampleSecret: ${example.secret}
Create ApiKey Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ApiKey(name: string, args: ApiKeyArgs, opts?: CustomResourceOptions);
@overload
def ApiKey(resource_name: str,
args: ApiKeyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ApiKey(resource_name: str,
opts: Optional[ResourceOptions] = None,
name: Optional[str] = None,
service_account_id: Optional[str] = None)
func NewApiKey(ctx *Context, name string, args ApiKeyArgs, opts ...ResourceOption) (*ApiKey, error)
public ApiKey(string name, ApiKeyArgs args, CustomResourceOptions? opts = null)
public ApiKey(String name, ApiKeyArgs args)
public ApiKey(String name, ApiKeyArgs args, CustomResourceOptions options)
type: cockroach:ApiKey
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 ApiKeyArgs
- 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 ApiKeyArgs
- 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 ApiKeyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ApiKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ApiKeyArgs
- 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 apiKeyResource = new Cockroach.ApiKey("apiKeyResource", new()
{
Name = "string",
ServiceAccountId = "string",
});
example, err := cockroach.NewApiKey(ctx, "apiKeyResource", &cockroach.ApiKeyArgs{
Name: pulumi.String("string"),
ServiceAccountId: pulumi.String("string"),
})
var apiKeyResource = new ApiKey("apiKeyResource", ApiKeyArgs.builder()
.name("string")
.serviceAccountId("string")
.build());
api_key_resource = cockroach.ApiKey("apiKeyResource",
name="string",
service_account_id="string")
const apiKeyResource = new cockroach.ApiKey("apiKeyResource", {
name: "string",
serviceAccountId: "string",
});
type: cockroach:ApiKey
properties:
name: string
serviceAccountId: string
ApiKey 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 ApiKey resource accepts the following input properties:
- Name string
- Name of the api key.
- Service
Account stringId
- Name string
- Name of the api key.
- Service
Account stringId
- name String
- Name of the api key.
- service
Account StringId
- name string
- Name of the api key.
- service
Account stringId
- name str
- Name of the api key.
- service_
account_ strid
- name String
- Name of the api key.
- service
Account StringId
Outputs
All input properties are implicitly available as output properties. Additionally, the ApiKey resource produces the following output properties:
- created_
at str - Creation time of the api key.
- id str
- The provider-assigned unique ID for this managed resource.
- secret str
Look up Existing ApiKey Resource
Get an existing ApiKey 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?: ApiKeyState, opts?: CustomResourceOptions): ApiKey
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
created_at: Optional[str] = None,
name: Optional[str] = None,
secret: Optional[str] = None,
service_account_id: Optional[str] = None) -> ApiKey
func GetApiKey(ctx *Context, name string, id IDInput, state *ApiKeyState, opts ...ResourceOption) (*ApiKey, error)
public static ApiKey Get(string name, Input<string> id, ApiKeyState? state, CustomResourceOptions? opts = null)
public static ApiKey get(String name, Output<String> id, ApiKeyState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- Created
At string - Creation time of the api key.
- Name string
- Name of the api key.
- Secret string
- Service
Account stringId
- Created
At string - Creation time of the api key.
- Name string
- Name of the api key.
- Secret string
- Service
Account stringId
- created
At String - Creation time of the api key.
- name String
- Name of the api key.
- secret String
- service
Account StringId
- created
At string - Creation time of the api key.
- name string
- Name of the api key.
- secret string
- service
Account stringId
- created_
at str - Creation time of the api key.
- name str
- Name of the api key.
- secret str
- service_
account_ strid
- created
At String - Creation time of the api key.
- name String
- Name of the api key.
- secret String
- service
Account StringId
Import
Since the secret, is not retreivable after creation, it must be provided
during import. The API key ID can be derived from the secret.
$ pulumi import cockroach:index/apiKey:ApiKey format: <resource> <api key secret>
$ pulumi import cockroach:index/apiKey:ApiKey example CCDB1_D4zMI3pZTmk5rGrzYqMhbc_NkcXLI8d81Mtx3djD45iwPfgtnaRv0XCh0Z9047K
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.