@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
431 lines (430 loc) • 20.5 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* A Secret is a logical secret whose value and versions can be accessed.
*
* To get more information about Secret, see:
*
* * [API documentation](https://cloud.google.com/secret-manager/docs/reference/rest/v1/projects.secrets)
* * How-to Guides
* * [Create and deploy a Secret](https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets)
*
* ## Example Usage
*
* ### Secret Config Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const secret_basic = new gcp.secretmanager.Secret("secret-basic", {
* secretId: "secret",
* labels: {
* label: "my-label",
* },
* replication: {
* userManaged: {
* replicas: [
* {
* location: "us-central1",
* },
* {
* location: "us-east1",
* },
* ],
* },
* },
* });
* ```
* ### Secret With Annotations
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const secret_with_annotations = new gcp.secretmanager.Secret("secret-with-annotations", {
* secretId: "secret",
* labels: {
* label: "my-label",
* },
* annotations: {
* key1: "someval",
* key2: "someval2",
* key3: "someval3",
* key4: "someval4",
* key5: "someval5",
* },
* replication: {
* auto: {},
* },
* });
* ```
* ### Secret With Version Destroy Ttl
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const secret_with_version_destroy_ttl = new gcp.secretmanager.Secret("secret-with-version-destroy-ttl", {
* secretId: "secret",
* versionDestroyTtl: "2592000s",
* replication: {
* auto: {},
* },
* });
* ```
* ### Secret With Automatic Cmek
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const project = gcp.organizations.getProject({});
* const kms_secret_binding = new gcp.kms.CryptoKeyIAMMember("kms-secret-binding", {
* cryptoKeyId: "kms-key",
* role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
* member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-secretmanager.iam.gserviceaccount.com`),
* });
* const secret_with_automatic_cmek = new gcp.secretmanager.Secret("secret-with-automatic-cmek", {
* secretId: "secret",
* replication: {
* auto: {
* customerManagedEncryption: {
* kmsKeyName: "kms-key",
* },
* },
* },
* }, {
* dependsOn: [kms_secret_binding],
* });
* ```
*
* ## Import
*
* Secret can be imported using any of these accepted formats:
*
* * `projects/{{project}}/secrets/{{secret_id}}`
*
* * `{{project}}/{{secret_id}}`
*
* * `{{secret_id}}`
*
* When using the `pulumi import` command, Secret can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:secretmanager/secret:Secret default projects/{{project}}/secrets/{{secret_id}}
* ```
*
* ```sh
* $ pulumi import gcp:secretmanager/secret:Secret default {{project}}/{{secret_id}}
* ```
*
* ```sh
* $ pulumi import gcp:secretmanager/secret:Secret default {{secret_id}}
* ```
*/
export declare class Secret extends pulumi.CustomResource {
/**
* Get an existing Secret resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: SecretState, opts?: pulumi.CustomResourceOptions): Secret;
/**
* Returns true if the given object is an instance of Secret. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is Secret;
/**
* Custom metadata about the secret. Annotations are distinct from various forms of labels. Annotations exist to allow
* client tools to store their own state information without requiring a database. Annotation keys must be between 1 and 63
* characters long, have a UTF-8 encoding of maximum 128 bytes, begin and end with an alphanumeric character ([a-z0-9A-Z]),
* and may have dashes (-), underscores (_), dots (.), and alphanumerics in between these symbols. The total size of
* annotation keys and values must be less than 16KiB. An object containing a list of "key": value pairs. Example: {
* "name": "wrench", "mass": "1.3kg", "count": "3" }. **Note**: This field is non-authoritative, and will only manage the
* annotations present in your configuration. Please refer to the field 'effective_annotations' for all of the annotations
* present on the resource.
*/
readonly annotations: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* The time at which the Secret was created.
*/
readonly createTime: pulumi.Output<string>;
readonly effectiveAnnotations: pulumi.Output<{
[key: string]: string;
}>;
/**
* All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
*/
readonly effectiveLabels: pulumi.Output<{
[key: string]: string;
}>;
/**
* Timestamp in UTC when the Secret is scheduled to expire. This is always provided on output, regardless of what was sent
* on input. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
* Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". Only one of 'expire_time' or 'ttl' can be
* provided.
*/
readonly expireTime: pulumi.Output<string>;
/**
* The labels assigned to this Secret. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of
* maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
* Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to
* the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63} No more than 64 labels can be assigned to a given
* resource. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3"
* }. **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. Please
* refer to the field 'effective_labels' for all of the labels present on the resource.
*/
readonly labels: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* The resource name of the Secret. Format:
* `projects/{{project}}/secrets/{{secret_id}}`
*/
readonly name: pulumi.Output<string>;
readonly project: pulumi.Output<string>;
/**
* The combination of labels configured directly on the resource
* and default labels configured on the provider.
*/
readonly pulumiLabels: pulumi.Output<{
[key: string]: string;
}>;
/**
* The replication policy of the secret data attached to the Secret. It cannot be changed
* after the Secret has been created.
* Structure is documented below.
*/
readonly replication: pulumi.Output<outputs.secretmanager.SecretReplication>;
/**
* The rotation time and period for a Secret. At 'next_rotation_time', Secret Manager will send a Pub/Sub notification to
* the topics configured on the Secret. 'topics' must be set to configure rotation.
*/
readonly rotation: pulumi.Output<outputs.secretmanager.SecretRotation | undefined>;
/**
* This must be unique within the project.
*/
readonly secretId: pulumi.Output<string>;
/**
* A list of up to 10 Pub/Sub topics to which messages are published when control plane operations are called on the secret
* or its versions.
*/
readonly topics: pulumi.Output<outputs.secretmanager.SecretTopic[] | undefined>;
/**
* The TTL for the Secret. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
* Only one of 'ttl' or 'expire_time' can be provided.
*/
readonly ttl: pulumi.Output<string | undefined>;
/**
* Mapping from version alias to version name. A version alias is a string with a maximum length of 63 characters and can
* contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore ('_') characters. An alias string
* must start with a letter and cannot be the string 'latest' or 'NEW'. No more than 50 aliases can be assigned to a given
* secret. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
*/
readonly versionAliases: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* Secret Version TTL after destruction request. This is a part of the delayed delete feature on Secret Version. For secret
* with versionDestroyTtl>0, version destruction doesn't happen immediately on calling destroy instead the version goes to
* a disabled state and the actual destruction happens after this TTL expires.
*/
readonly versionDestroyTtl: pulumi.Output<string | undefined>;
/**
* Create a Secret resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: SecretArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Secret resources.
*/
export interface SecretState {
/**
* Custom metadata about the secret. Annotations are distinct from various forms of labels. Annotations exist to allow
* client tools to store their own state information without requiring a database. Annotation keys must be between 1 and 63
* characters long, have a UTF-8 encoding of maximum 128 bytes, begin and end with an alphanumeric character ([a-z0-9A-Z]),
* and may have dashes (-), underscores (_), dots (.), and alphanumerics in between these symbols. The total size of
* annotation keys and values must be less than 16KiB. An object containing a list of "key": value pairs. Example: {
* "name": "wrench", "mass": "1.3kg", "count": "3" }. **Note**: This field is non-authoritative, and will only manage the
* annotations present in your configuration. Please refer to the field 'effective_annotations' for all of the annotations
* present on the resource.
*/
annotations?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* The time at which the Secret was created.
*/
createTime?: pulumi.Input<string>;
effectiveAnnotations?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
*/
effectiveLabels?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Timestamp in UTC when the Secret is scheduled to expire. This is always provided on output, regardless of what was sent
* on input. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
* Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". Only one of 'expire_time' or 'ttl' can be
* provided.
*/
expireTime?: pulumi.Input<string>;
/**
* The labels assigned to this Secret. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of
* maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
* Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to
* the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63} No more than 64 labels can be assigned to a given
* resource. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3"
* }. **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. Please
* refer to the field 'effective_labels' for all of the labels present on the resource.
*/
labels?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* The resource name of the Secret. Format:
* `projects/{{project}}/secrets/{{secret_id}}`
*/
name?: pulumi.Input<string>;
project?: pulumi.Input<string>;
/**
* The combination of labels configured directly on the resource
* and default labels configured on the provider.
*/
pulumiLabels?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* The replication policy of the secret data attached to the Secret. It cannot be changed
* after the Secret has been created.
* Structure is documented below.
*/
replication?: pulumi.Input<inputs.secretmanager.SecretReplication>;
/**
* The rotation time and period for a Secret. At 'next_rotation_time', Secret Manager will send a Pub/Sub notification to
* the topics configured on the Secret. 'topics' must be set to configure rotation.
*/
rotation?: pulumi.Input<inputs.secretmanager.SecretRotation>;
/**
* This must be unique within the project.
*/
secretId?: pulumi.Input<string>;
/**
* A list of up to 10 Pub/Sub topics to which messages are published when control plane operations are called on the secret
* or its versions.
*/
topics?: pulumi.Input<pulumi.Input<inputs.secretmanager.SecretTopic>[]>;
/**
* The TTL for the Secret. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
* Only one of 'ttl' or 'expire_time' can be provided.
*/
ttl?: pulumi.Input<string>;
/**
* Mapping from version alias to version name. A version alias is a string with a maximum length of 63 characters and can
* contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore ('_') characters. An alias string
* must start with a letter and cannot be the string 'latest' or 'NEW'. No more than 50 aliases can be assigned to a given
* secret. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
*/
versionAliases?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Secret Version TTL after destruction request. This is a part of the delayed delete feature on Secret Version. For secret
* with versionDestroyTtl>0, version destruction doesn't happen immediately on calling destroy instead the version goes to
* a disabled state and the actual destruction happens after this TTL expires.
*/
versionDestroyTtl?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a Secret resource.
*/
export interface SecretArgs {
/**
* Custom metadata about the secret. Annotations are distinct from various forms of labels. Annotations exist to allow
* client tools to store their own state information without requiring a database. Annotation keys must be between 1 and 63
* characters long, have a UTF-8 encoding of maximum 128 bytes, begin and end with an alphanumeric character ([a-z0-9A-Z]),
* and may have dashes (-), underscores (_), dots (.), and alphanumerics in between these symbols. The total size of
* annotation keys and values must be less than 16KiB. An object containing a list of "key": value pairs. Example: {
* "name": "wrench", "mass": "1.3kg", "count": "3" }. **Note**: This field is non-authoritative, and will only manage the
* annotations present in your configuration. Please refer to the field 'effective_annotations' for all of the annotations
* present on the resource.
*/
annotations?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Timestamp in UTC when the Secret is scheduled to expire. This is always provided on output, regardless of what was sent
* on input. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
* Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". Only one of 'expire_time' or 'ttl' can be
* provided.
*/
expireTime?: pulumi.Input<string>;
/**
* The labels assigned to this Secret. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of
* maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}
* Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to
* the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63} No more than 64 labels can be assigned to a given
* resource. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3"
* }. **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. Please
* refer to the field 'effective_labels' for all of the labels present on the resource.
*/
labels?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
project?: pulumi.Input<string>;
/**
* The replication policy of the secret data attached to the Secret. It cannot be changed
* after the Secret has been created.
* Structure is documented below.
*/
replication: pulumi.Input<inputs.secretmanager.SecretReplication>;
/**
* The rotation time and period for a Secret. At 'next_rotation_time', Secret Manager will send a Pub/Sub notification to
* the topics configured on the Secret. 'topics' must be set to configure rotation.
*/
rotation?: pulumi.Input<inputs.secretmanager.SecretRotation>;
/**
* This must be unique within the project.
*/
secretId: pulumi.Input<string>;
/**
* A list of up to 10 Pub/Sub topics to which messages are published when control plane operations are called on the secret
* or its versions.
*/
topics?: pulumi.Input<pulumi.Input<inputs.secretmanager.SecretTopic>[]>;
/**
* The TTL for the Secret. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
* Only one of 'ttl' or 'expire_time' can be provided.
*/
ttl?: pulumi.Input<string>;
/**
* Mapping from version alias to version name. A version alias is a string with a maximum length of 63 characters and can
* contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore ('_') characters. An alias string
* must start with a letter and cannot be the string 'latest' or 'NEW'. No more than 50 aliases can be assigned to a given
* secret. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
*/
versionAliases?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Secret Version TTL after destruction request. This is a part of the delayed delete feature on Secret Version. For secret
* with versionDestroyTtl>0, version destruction doesn't happen immediately on calling destroy instead the version goes to
* a disabled state and the actual destruction happens after this TTL expires.
*/
versionDestroyTtl?: pulumi.Input<string>;
}