published on Tuesday, Oct 27, 2026 by Pulumi
published on Tuesday, Oct 27, 2026 by Pulumi
Provides a KMS Secret resource.
For information about KMS Secret and how to use it, see What is Secret.
NOTE: Available since v1.76.0.
NOTE: Starting from KMS 3.0, secrets are created inside a dedicated KMS instance. When you create a secret in KMS 3.0, you must specify
dkmsInstanceIdandencryptionKeyId. The examples below show how to provide them. If your account still uses the legacy shared KMS and does not require a dedicated instance, these two parameters can be omitted, but this legacy behavior is no longer recommended.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
// Replace the IDs with your own dedicated KMS instance and key.
const _default = alicloud.kms.getInstances({
ids: ["kst-bjj62d8f5e0sgtx8h****"],
});
const defaultGetKeys = alicloud.kms.getKeys({
ids: ["key-gzz63ff0db5hg3qje****"],
});
const defaultSecret = new alicloud.kms.Secret("default", {
secretName: name,
secretData: "Secret data",
versionId: "v1",
dkmsInstanceId: _default.then(_default => _default.instances?.[0]?.instanceId),
encryptionKeyId: defaultGetKeys.then(defaultGetKeys => defaultGetKeys.keys?.[0]?.id),
forceDeleteWithoutRecovery: true,
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
# Replace the IDs with your own dedicated KMS instance and key.
default = alicloud.kms.get_instances(ids=["kst-bjj62d8f5e0sgtx8h****"])
default_get_keys = alicloud.kms.get_keys(ids=["key-gzz63ff0db5hg3qje****"])
default_secret = alicloud.kms.Secret("default",
secret_name=name,
secret_data="Secret data",
version_id="v1",
dkms_instance_id=default.instances[0].instance_id,
encryption_key_id=default_get_keys.keys[0].id,
force_delete_without_recovery=True)
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v4/go/alicloud/kms"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
// Replace the IDs with your own dedicated KMS instance and key.
_default, err := kms.GetInstances(ctx, &kms.GetInstancesArgs{
Ids: []string{
"kst-bjj62d8f5e0sgtx8h****",
},
}, nil)
if err != nil {
return err
}
defaultGetKeys, err := kms.GetKeys(ctx, &kms.GetKeysArgs{
Ids: []string{
"key-gzz63ff0db5hg3qje****",
},
}, nil)
if err != nil {
return err
}
_, err = kms.NewSecret(ctx, "default", &kms.SecretArgs{
SecretName: pulumi.String(name),
SecretData: pulumi.String("Secret data"),
VersionId: pulumi.String("v1"),
DkmsInstanceId: pulumi.String(_default.Instances[0].InstanceId),
EncryptionKeyId: pulumi.String(defaultGetKeys.Keys[0].Id),
ForceDeleteWithoutRecovery: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
// Replace the IDs with your own dedicated KMS instance and key.
var @default = AliCloud.Kms.GetInstances.Invoke(new()
{
Ids = new[]
{
"kst-bjj62d8f5e0sgtx8h****",
},
});
var defaultGetKeys = AliCloud.Kms.GetKeys.Invoke(new()
{
Ids = new[]
{
"key-gzz63ff0db5hg3qje****",
},
});
var defaultSecret = new AliCloud.Kms.Secret("default", new()
{
SecretName = name,
SecretData = "Secret data",
VersionId = "v1",
DkmsInstanceId = @default.Apply(@default => @default.Apply(getInstancesResult => getInstancesResult.Instances[0]?.InstanceId)),
EncryptionKeyId = defaultGetKeys.Apply(getKeysResult => getKeysResult.Keys[0]?.Id),
ForceDeleteWithoutRecovery = true,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.kms.KmsFunctions;
import com.pulumi.alicloud.kms.inputs.GetInstancesArgs;
import com.pulumi.alicloud.kms.inputs.GetKeysArgs;
import com.pulumi.alicloud.kms.Secret;
import com.pulumi.alicloud.kms.SecretArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
// Replace the IDs with your own dedicated KMS instance and key.
final var default = KmsFunctions.getInstances(GetInstancesArgs.builder()
.ids("kst-bjj62d8f5e0sgtx8h****")
.build());
final var defaultGetKeys = KmsFunctions.getKeys(GetKeysArgs.builder()
.ids("key-gzz63ff0db5hg3qje****")
.build());
var defaultSecret = new Secret("defaultSecret", SecretArgs.builder()
.secretName(name)
.secretData("Secret data")
.versionId("v1")
.dkmsInstanceId(default_.instances()[0].instanceId())
.encryptionKeyId(defaultGetKeys.keys()[0].id())
.forceDeleteWithoutRecovery(true)
.build());
}
}
configuration:
name:
type: string
default: terraform-example
resources:
defaultSecret:
type: alicloud:kms:Secret
name: default
properties:
secretName: ${name}
secretData: Secret data
versionId: v1
dkmsInstanceId: ${default.instances[0].instanceId}
encryptionKeyId: ${defaultGetKeys.keys[0].id}
forceDeleteWithoutRecovery: true
variables:
# Replace the IDs with your own dedicated KMS instance and key.
default:
fn::invoke:
function: alicloud:kms:getInstances
arguments:
ids:
- kst-bjj62d8f5e0sgtx8h****
defaultGetKeys:
fn::invoke:
function: alicloud:kms:getKeys
arguments:
ids:
- key-gzz63ff0db5hg3qje****
terraform {
required_providers {
alicloud = {
source = "pulumi/alicloud"
}
}
}
data "alicloud_kms_instances" "default" {
ids = ["kst-bjj62d8f5e0sgtx8h****"]
}
data "alicloud_kms_keys" "defaultGetKeys" {
ids = ["key-gzz63ff0db5hg3qje****"]
}
resource "alicloud_kms_secret" "default" {
lifecycle {
create_before_destroy = true
}
secret_name = var.name
secret_data = "Secret data"
version_id = "v1"
dkms_instance_id = data.alicloud_kms_instances.default.instances[0].instance_id
encryption_key_id = data.alicloud_kms_keys.defaultGetKeys.keys[0].id
force_delete_without_recovery = true
}
variable "name" {
type = string
default = "terraform-example"
}
# Replace the IDs with your own dedicated KMS instance and key.
Create a generic secret
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const _default = alicloud.kms.getInstances({
ids: ["kst-bjj62d8f5e0sgtx8h****"],
});
const defaultGetKeys = alicloud.kms.getKeys({
ids: ["key-gzz63ff0db5hg3qje****"],
});
const generic = new alicloud.kms.Secret("generic", {
secretName: name,
secretType: "Generic",
secretData: "Secret data",
versionId: "v1",
secretDataType: "text",
dkmsInstanceId: _default.then(_default => _default.instances?.[0]?.instanceId),
encryptionKeyId: defaultGetKeys.then(defaultGetKeys => defaultGetKeys.keys?.[0]?.id),
forceDeleteWithoutRecovery: true,
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = alicloud.kms.get_instances(ids=["kst-bjj62d8f5e0sgtx8h****"])
default_get_keys = alicloud.kms.get_keys(ids=["key-gzz63ff0db5hg3qje****"])
generic = alicloud.kms.Secret("generic",
secret_name=name,
secret_type="Generic",
secret_data="Secret data",
version_id="v1",
secret_data_type="text",
dkms_instance_id=default.instances[0].instance_id,
encryption_key_id=default_get_keys.keys[0].id,
force_delete_without_recovery=True)
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v4/go/alicloud/kms"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := kms.GetInstances(ctx, &kms.GetInstancesArgs{
Ids: []string{
"kst-bjj62d8f5e0sgtx8h****",
},
}, nil)
if err != nil {
return err
}
defaultGetKeys, err := kms.GetKeys(ctx, &kms.GetKeysArgs{
Ids: []string{
"key-gzz63ff0db5hg3qje****",
},
}, nil)
if err != nil {
return err
}
_, err = kms.NewSecret(ctx, "generic", &kms.SecretArgs{
SecretName: pulumi.String(name),
SecretType: pulumi.String("Generic"),
SecretData: pulumi.String("Secret data"),
VersionId: pulumi.String("v1"),
SecretDataType: pulumi.String("text"),
DkmsInstanceId: pulumi.String(_default.Instances[0].InstanceId),
EncryptionKeyId: pulumi.String(defaultGetKeys.Keys[0].Id),
ForceDeleteWithoutRecovery: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var @default = AliCloud.Kms.GetInstances.Invoke(new()
{
Ids = new[]
{
"kst-bjj62d8f5e0sgtx8h****",
},
});
var defaultGetKeys = AliCloud.Kms.GetKeys.Invoke(new()
{
Ids = new[]
{
"key-gzz63ff0db5hg3qje****",
},
});
var generic = new AliCloud.Kms.Secret("generic", new()
{
SecretName = name,
SecretType = "Generic",
SecretData = "Secret data",
VersionId = "v1",
SecretDataType = "text",
DkmsInstanceId = @default.Apply(@default => @default.Apply(getInstancesResult => getInstancesResult.Instances[0]?.InstanceId)),
EncryptionKeyId = defaultGetKeys.Apply(getKeysResult => getKeysResult.Keys[0]?.Id),
ForceDeleteWithoutRecovery = true,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.kms.KmsFunctions;
import com.pulumi.alicloud.kms.inputs.GetInstancesArgs;
import com.pulumi.alicloud.kms.inputs.GetKeysArgs;
import com.pulumi.alicloud.kms.Secret;
import com.pulumi.alicloud.kms.SecretArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
final var default = KmsFunctions.getInstances(GetInstancesArgs.builder()
.ids("kst-bjj62d8f5e0sgtx8h****")
.build());
final var defaultGetKeys = KmsFunctions.getKeys(GetKeysArgs.builder()
.ids("key-gzz63ff0db5hg3qje****")
.build());
var generic = new Secret("generic", SecretArgs.builder()
.secretName(name)
.secretType("Generic")
.secretData("Secret data")
.versionId("v1")
.secretDataType("text")
.dkmsInstanceId(default_.instances()[0].instanceId())
.encryptionKeyId(defaultGetKeys.keys()[0].id())
.forceDeleteWithoutRecovery(true)
.build());
}
}
configuration:
name:
type: string
default: terraform-example
resources:
generic:
type: alicloud:kms:Secret
properties:
secretName: ${name}
secretType: Generic
secretData: Secret data
versionId: v1
secretDataType: text
dkmsInstanceId: ${default.instances[0].instanceId}
encryptionKeyId: ${defaultGetKeys.keys[0].id}
forceDeleteWithoutRecovery: true
variables:
default:
fn::invoke:
function: alicloud:kms:getInstances
arguments:
ids:
- kst-bjj62d8f5e0sgtx8h****
defaultGetKeys:
fn::invoke:
function: alicloud:kms:getKeys
arguments:
ids:
- key-gzz63ff0db5hg3qje****
terraform {
required_providers {
alicloud = {
source = "pulumi/alicloud"
}
}
}
data "alicloud_kms_instances" "default" {
ids = ["kst-bjj62d8f5e0sgtx8h****"]
}
data "alicloud_kms_keys" "defaultGetKeys" {
ids = ["key-gzz63ff0db5hg3qje****"]
}
resource "alicloud_kms_secret" "generic" {
lifecycle {
create_before_destroy = true
}
secret_name = var.name
secret_type = "Generic"
secret_data = "Secret data"
version_id = "v1"
secret_data_type = "text"
dkms_instance_id = data.alicloud_kms_instances.default.instances[0].instance_id
encryption_key_id = data.alicloud_kms_keys.defaultGetKeys.keys[0].id
force_delete_without_recovery = true
}
variable "name" {
type = string
default = "terraform-example"
}
Create an RDS secret
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const _default = alicloud.kms.getInstances({
ids: ["kst-bjj62d8f5e0sgtx8h****"],
});
const defaultGetKeys = alicloud.kms.getKeys({
ids: ["key-gzz63ff0db5hg3qje****"],
});
const rds = new alicloud.kms.Secret("rds", {
secretName: name,
secretType: "Rds",
secretData: JSON.stringify({
Accounts: [{
AccountName: "rds_user",
AccountPassword: "YourPassword12345!",
}],
}),
versionId: "v1",
dkmsInstanceId: _default.then(_default => _default.instances?.[0]?.instanceId),
encryptionKeyId: defaultGetKeys.then(defaultGetKeys => defaultGetKeys.keys?.[0]?.id),
extendedConfig: JSON.stringify({
SecretSubType: "SingleUser",
DBInstanceId: "rm-bp1b3dd3a506e****",
}),
forceDeleteWithoutRecovery: true,
});
import pulumi
import json
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = alicloud.kms.get_instances(ids=["kst-bjj62d8f5e0sgtx8h****"])
default_get_keys = alicloud.kms.get_keys(ids=["key-gzz63ff0db5hg3qje****"])
rds = alicloud.kms.Secret("rds",
secret_name=name,
secret_type="Rds",
secret_data=json.dumps({
"Accounts": [{
"AccountName": "rds_user",
"AccountPassword": "YourPassword12345!",
}],
}),
version_id="v1",
dkms_instance_id=default.instances[0].instance_id,
encryption_key_id=default_get_keys.keys[0].id,
extended_config=json.dumps({
"SecretSubType": "SingleUser",
"DBInstanceId": "rm-bp1b3dd3a506e****",
}),
force_delete_without_recovery=True)
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-alicloud/sdk/v4/go/alicloud/kms"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := kms.GetInstances(ctx, &kms.GetInstancesArgs{
Ids: []string{
"kst-bjj62d8f5e0sgtx8h****",
},
}, nil)
if err != nil {
return err
}
defaultGetKeys, err := kms.GetKeys(ctx, &kms.GetKeysArgs{
Ids: []string{
"key-gzz63ff0db5hg3qje****",
},
}, nil)
if err != nil {
return err
}
tmpJSON0, err := json.Marshal(map[string][]map[string]string{
"Accounts": []map[string]string{
{
"AccountName": "rds_user",
"AccountPassword": "YourPassword12345!",
},
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
tmpJSON1, err := json.Marshal(map[string]string{
"SecretSubType": "SingleUser",
"DBInstanceId": "rm-bp1b3dd3a506e****",
})
if err != nil {
return err
}
json1 := string(tmpJSON1)
_, err = kms.NewSecret(ctx, "rds", &kms.SecretArgs{
SecretName: pulumi.String(name),
SecretType: pulumi.String("Rds"),
SecretData: pulumi.String(json0),
VersionId: pulumi.String("v1"),
DkmsInstanceId: pulumi.String(_default.Instances[0].InstanceId),
EncryptionKeyId: pulumi.String(defaultGetKeys.Keys[0].Id),
ExtendedConfig: pulumi.String(json1),
ForceDeleteWithoutRecovery: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var @default = AliCloud.Kms.GetInstances.Invoke(new()
{
Ids = new[]
{
"kst-bjj62d8f5e0sgtx8h****",
},
});
var defaultGetKeys = AliCloud.Kms.GetKeys.Invoke(new()
{
Ids = new[]
{
"key-gzz63ff0db5hg3qje****",
},
});
var rds = new AliCloud.Kms.Secret("rds", new()
{
SecretName = name,
SecretType = "Rds",
SecretData = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["Accounts"] = new[]
{
new Dictionary<string, object?>
{
["AccountName"] = "rds_user",
["AccountPassword"] = "YourPassword12345!",
},
},
}),
VersionId = "v1",
DkmsInstanceId = @default.Apply(@default => @default.Apply(getInstancesResult => getInstancesResult.Instances[0]?.InstanceId)),
EncryptionKeyId = defaultGetKeys.Apply(getKeysResult => getKeysResult.Keys[0]?.Id),
ExtendedConfig = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["SecretSubType"] = "SingleUser",
["DBInstanceId"] = "rm-bp1b3dd3a506e****",
}),
ForceDeleteWithoutRecovery = true,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.kms.KmsFunctions;
import com.pulumi.alicloud.kms.inputs.GetInstancesArgs;
import com.pulumi.alicloud.kms.inputs.GetKeysArgs;
import com.pulumi.alicloud.kms.Secret;
import com.pulumi.alicloud.kms.SecretArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.ArrayList;
import java.util.Arrays;
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 config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
final var default = KmsFunctions.getInstances(GetInstancesArgs.builder()
.ids("kst-bjj62d8f5e0sgtx8h****")
.build());
final var defaultGetKeys = KmsFunctions.getKeys(GetKeysArgs.builder()
.ids("key-gzz63ff0db5hg3qje****")
.build());
var rds = new Secret("rds", SecretArgs.builder()
.secretName(name)
.secretType("Rds")
.secretData(serializeJson(
jsonObject(
jsonProperty("Accounts", jsonArray(jsonObject(
jsonProperty("AccountName", "rds_user"),
jsonProperty("AccountPassword", "YourPassword12345!")
)))
)))
.versionId("v1")
.dkmsInstanceId(default_.instances()[0].instanceId())
.encryptionKeyId(defaultGetKeys.keys()[0].id())
.extendedConfig(serializeJson(
jsonObject(
jsonProperty("SecretSubType", "SingleUser"),
jsonProperty("DBInstanceId", "rm-bp1b3dd3a506e****")
)))
.forceDeleteWithoutRecovery(true)
.build());
}
}
configuration:
name:
type: string
default: terraform-example
resources:
rds:
type: alicloud:kms:Secret
properties:
secretName: ${name}
secretType: Rds
secretData:
fn::toJSON:
Accounts:
- AccountName: rds_user
AccountPassword: YourPassword12345!
versionId: v1
dkmsInstanceId: ${default.instances[0].instanceId}
encryptionKeyId: ${defaultGetKeys.keys[0].id}
extendedConfig:
fn::toJSON:
SecretSubType: SingleUser
DBInstanceId: rm-bp1b3dd3a506e****
forceDeleteWithoutRecovery: true
variables:
default:
fn::invoke:
function: alicloud:kms:getInstances
arguments:
ids:
- kst-bjj62d8f5e0sgtx8h****
defaultGetKeys:
fn::invoke:
function: alicloud:kms:getKeys
arguments:
ids:
- key-gzz63ff0db5hg3qje****
terraform {
required_providers {
alicloud = {
source = "pulumi/alicloud"
}
}
}
data "alicloud_kms_instances" "default" {
ids = ["kst-bjj62d8f5e0sgtx8h****"]
}
data "alicloud_kms_keys" "defaultGetKeys" {
ids = ["key-gzz63ff0db5hg3qje****"]
}
resource "alicloud_kms_secret" "rds" {
lifecycle {
create_before_destroy = true
}
secret_name = var.name
secret_type = "Rds"
secret_data = jsonencode({
"Accounts" = [{
"AccountName" = "rds_user"
"AccountPassword" = "YourPassword12345!"
}]
})
version_id = "v1"
dkms_instance_id = data.alicloud_kms_instances.default.instances[0].instance_id
encryption_key_id = data.alicloud_kms_keys.defaultGetKeys.keys[0].id
extended_config = jsonencode({
"SecretSubType" = "SingleUser"
"DBInstanceId" = "rm-bp1b3dd3a506e****"
})
force_delete_without_recovery = true
}
variable "name" {
type = string
default = "terraform-example"
}
Create a Redis/Tair secret
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const _default = alicloud.kms.getInstances({
ids: ["kst-bjj62d8f5e0sgtx8h****"],
});
const defaultGetKeys = alicloud.kms.getKeys({
ids: ["key-gzz63ff0db5hg3qje****"],
});
const redis = new alicloud.kms.Secret("redis", {
secretName: name,
secretType: "Redis",
secretData: "$Auto",
versionId: "v1",
dkmsInstanceId: _default.then(_default => _default.instances?.[0]?.instanceId),
encryptionKeyId: defaultGetKeys.then(defaultGetKeys => defaultGetKeys.keys?.[0]?.id),
extendedConfig: JSON.stringify({
SecretSubType: "DoubleUsers",
AccountName: "redis_user",
CloneAccountName: "redis_user_clone",
AccountPrivilege: "ROLE_READ_ONLY",
InstanceId: "r-bp1b3dd3a506e****",
RegionId: "cn-hangzhou",
}),
forceDeleteWithoutRecovery: true,
});
import pulumi
import json
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = alicloud.kms.get_instances(ids=["kst-bjj62d8f5e0sgtx8h****"])
default_get_keys = alicloud.kms.get_keys(ids=["key-gzz63ff0db5hg3qje****"])
redis = alicloud.kms.Secret("redis",
secret_name=name,
secret_type="Redis",
secret_data="$Auto",
version_id="v1",
dkms_instance_id=default.instances[0].instance_id,
encryption_key_id=default_get_keys.keys[0].id,
extended_config=json.dumps({
"SecretSubType": "DoubleUsers",
"AccountName": "redis_user",
"CloneAccountName": "redis_user_clone",
"AccountPrivilege": "ROLE_READ_ONLY",
"InstanceId": "r-bp1b3dd3a506e****",
"RegionId": "cn-hangzhou",
}),
force_delete_without_recovery=True)
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-alicloud/sdk/v4/go/alicloud/kms"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := kms.GetInstances(ctx, &kms.GetInstancesArgs{
Ids: []string{
"kst-bjj62d8f5e0sgtx8h****",
},
}, nil)
if err != nil {
return err
}
defaultGetKeys, err := kms.GetKeys(ctx, &kms.GetKeysArgs{
Ids: []string{
"key-gzz63ff0db5hg3qje****",
},
}, nil)
if err != nil {
return err
}
tmpJSON0, err := json.Marshal(map[string]string{
"SecretSubType": "DoubleUsers",
"AccountName": "redis_user",
"CloneAccountName": "redis_user_clone",
"AccountPrivilege": "ROLE_READ_ONLY",
"InstanceId": "r-bp1b3dd3a506e****",
"RegionId": "cn-hangzhou",
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = kms.NewSecret(ctx, "redis", &kms.SecretArgs{
SecretName: pulumi.String(name),
SecretType: pulumi.String("Redis"),
SecretData: pulumi.String("$Auto"),
VersionId: pulumi.String("v1"),
DkmsInstanceId: pulumi.String(_default.Instances[0].InstanceId),
EncryptionKeyId: pulumi.String(defaultGetKeys.Keys[0].Id),
ExtendedConfig: pulumi.String(json0),
ForceDeleteWithoutRecovery: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var @default = AliCloud.Kms.GetInstances.Invoke(new()
{
Ids = new[]
{
"kst-bjj62d8f5e0sgtx8h****",
},
});
var defaultGetKeys = AliCloud.Kms.GetKeys.Invoke(new()
{
Ids = new[]
{
"key-gzz63ff0db5hg3qje****",
},
});
var redis = new AliCloud.Kms.Secret("redis", new()
{
SecretName = name,
SecretType = "Redis",
SecretData = "$Auto",
VersionId = "v1",
DkmsInstanceId = @default.Apply(@default => @default.Apply(getInstancesResult => getInstancesResult.Instances[0]?.InstanceId)),
EncryptionKeyId = defaultGetKeys.Apply(getKeysResult => getKeysResult.Keys[0]?.Id),
ExtendedConfig = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["SecretSubType"] = "DoubleUsers",
["AccountName"] = "redis_user",
["CloneAccountName"] = "redis_user_clone",
["AccountPrivilege"] = "ROLE_READ_ONLY",
["InstanceId"] = "r-bp1b3dd3a506e****",
["RegionId"] = "cn-hangzhou",
}),
ForceDeleteWithoutRecovery = true,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.kms.KmsFunctions;
import com.pulumi.alicloud.kms.inputs.GetInstancesArgs;
import com.pulumi.alicloud.kms.inputs.GetKeysArgs;
import com.pulumi.alicloud.kms.Secret;
import com.pulumi.alicloud.kms.SecretArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.ArrayList;
import java.util.Arrays;
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 config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
final var default = KmsFunctions.getInstances(GetInstancesArgs.builder()
.ids("kst-bjj62d8f5e0sgtx8h****")
.build());
final var defaultGetKeys = KmsFunctions.getKeys(GetKeysArgs.builder()
.ids("key-gzz63ff0db5hg3qje****")
.build());
var redis = new Secret("redis", SecretArgs.builder()
.secretName(name)
.secretType("Redis")
.secretData("$Auto")
.versionId("v1")
.dkmsInstanceId(default_.instances()[0].instanceId())
.encryptionKeyId(defaultGetKeys.keys()[0].id())
.extendedConfig(serializeJson(
jsonObject(
jsonProperty("SecretSubType", "DoubleUsers"),
jsonProperty("AccountName", "redis_user"),
jsonProperty("CloneAccountName", "redis_user_clone"),
jsonProperty("AccountPrivilege", "ROLE_READ_ONLY"),
jsonProperty("InstanceId", "r-bp1b3dd3a506e****"),
jsonProperty("RegionId", "cn-hangzhou")
)))
.forceDeleteWithoutRecovery(true)
.build());
}
}
configuration:
name:
type: string
default: terraform-example
resources:
redis:
type: alicloud:kms:Secret
properties:
secretName: ${name}
secretType: Redis
secretData: $Auto
versionId: v1
dkmsInstanceId: ${default.instances[0].instanceId}
encryptionKeyId: ${defaultGetKeys.keys[0].id}
extendedConfig:
fn::toJSON:
SecretSubType: DoubleUsers
AccountName: redis_user
CloneAccountName: redis_user_clone
AccountPrivilege: ROLE_READ_ONLY
InstanceId: r-bp1b3dd3a506e****
RegionId: cn-hangzhou
forceDeleteWithoutRecovery: true
variables:
default:
fn::invoke:
function: alicloud:kms:getInstances
arguments:
ids:
- kst-bjj62d8f5e0sgtx8h****
defaultGetKeys:
fn::invoke:
function: alicloud:kms:getKeys
arguments:
ids:
- key-gzz63ff0db5hg3qje****
terraform {
required_providers {
alicloud = {
source = "pulumi/alicloud"
}
}
}
data "alicloud_kms_instances" "default" {
ids = ["kst-bjj62d8f5e0sgtx8h****"]
}
data "alicloud_kms_keys" "defaultGetKeys" {
ids = ["key-gzz63ff0db5hg3qje****"]
}
resource "alicloud_kms_secret" "redis" {
lifecycle {
create_before_destroy = true
}
secret_name = var.name
secret_type = "Redis"
secret_data = "$Auto"
version_id = "v1"
dkms_instance_id = data.alicloud_kms_instances.default.instances[0].instance_id
encryption_key_id = data.alicloud_kms_keys.defaultGetKeys.keys[0].id
extended_config = jsonencode({
"SecretSubType" = "DoubleUsers"
"AccountName" = "redis_user"
"CloneAccountName" = "redis_user_clone"
"AccountPrivilege" = "ROLE_READ_ONLY"
"InstanceId" = "r-bp1b3dd3a506e****"
"RegionId" = "cn-hangzhou"
})
force_delete_without_recovery = true
}
variable "name" {
type = string
default = "terraform-example"
}
Create a RAM credentials secret
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const _default = alicloud.kms.getInstances({
ids: ["kst-bjj62d8f5e0sgtx8h****"],
});
const defaultGetKeys = alicloud.kms.getKeys({
ids: ["key-gzz63ff0db5hg3qje****"],
});
const ram = new alicloud.kms.Secret("ram", {
secretName: "$Auto",
secretType: "RAMCredentials",
secretData: JSON.stringify({
AccessKeys: [{
AccessKeyId: "LTAI********************",
AccessKeySecret: "YourAccessKeySecret",
}],
}),
versionId: "v1",
dkmsInstanceId: _default.then(_default => _default.instances?.[0]?.instanceId),
encryptionKeyId: defaultGetKeys.then(defaultGetKeys => defaultGetKeys.keys?.[0]?.id),
extendedConfig: JSON.stringify({
SecretSubType: "RamUserAccessKey",
UserName: "ram_user",
}),
forceDeleteWithoutRecovery: true,
});
import pulumi
import json
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = alicloud.kms.get_instances(ids=["kst-bjj62d8f5e0sgtx8h****"])
default_get_keys = alicloud.kms.get_keys(ids=["key-gzz63ff0db5hg3qje****"])
ram = alicloud.kms.Secret("ram",
secret_name="$Auto",
secret_type="RAMCredentials",
secret_data=json.dumps({
"AccessKeys": [{
"AccessKeyId": "LTAI********************",
"AccessKeySecret": "YourAccessKeySecret",
}],
}),
version_id="v1",
dkms_instance_id=default.instances[0].instance_id,
encryption_key_id=default_get_keys.keys[0].id,
extended_config=json.dumps({
"SecretSubType": "RamUserAccessKey",
"UserName": "ram_user",
}),
force_delete_without_recovery=True)
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-alicloud/sdk/v4/go/alicloud/kms"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := kms.GetInstances(ctx, &kms.GetInstancesArgs{
Ids: []string{
"kst-bjj62d8f5e0sgtx8h****",
},
}, nil)
if err != nil {
return err
}
defaultGetKeys, err := kms.GetKeys(ctx, &kms.GetKeysArgs{
Ids: []string{
"key-gzz63ff0db5hg3qje****",
},
}, nil)
if err != nil {
return err
}
tmpJSON0, err := json.Marshal(map[string][]map[string]string{
"AccessKeys": []map[string]string{
{
"AccessKeyId": "LTAI********************",
"AccessKeySecret": "YourAccessKeySecret",
},
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
tmpJSON1, err := json.Marshal(map[string]string{
"SecretSubType": "RamUserAccessKey",
"UserName": "ram_user",
})
if err != nil {
return err
}
json1 := string(tmpJSON1)
_, err = kms.NewSecret(ctx, "ram", &kms.SecretArgs{
SecretName: pulumi.String("$Auto"),
SecretType: pulumi.String("RAMCredentials"),
SecretData: pulumi.String(json0),
VersionId: pulumi.String("v1"),
DkmsInstanceId: pulumi.String(_default.Instances[0].InstanceId),
EncryptionKeyId: pulumi.String(defaultGetKeys.Keys[0].Id),
ExtendedConfig: pulumi.String(json1),
ForceDeleteWithoutRecovery: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var @default = AliCloud.Kms.GetInstances.Invoke(new()
{
Ids = new[]
{
"kst-bjj62d8f5e0sgtx8h****",
},
});
var defaultGetKeys = AliCloud.Kms.GetKeys.Invoke(new()
{
Ids = new[]
{
"key-gzz63ff0db5hg3qje****",
},
});
var ram = new AliCloud.Kms.Secret("ram", new()
{
SecretName = "$Auto",
SecretType = "RAMCredentials",
SecretData = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["AccessKeys"] = new[]
{
new Dictionary<string, object?>
{
["AccessKeyId"] = "LTAI********************",
["AccessKeySecret"] = "YourAccessKeySecret",
},
},
}),
VersionId = "v1",
DkmsInstanceId = @default.Apply(@default => @default.Apply(getInstancesResult => getInstancesResult.Instances[0]?.InstanceId)),
EncryptionKeyId = defaultGetKeys.Apply(getKeysResult => getKeysResult.Keys[0]?.Id),
ExtendedConfig = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["SecretSubType"] = "RamUserAccessKey",
["UserName"] = "ram_user",
}),
ForceDeleteWithoutRecovery = true,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.kms.KmsFunctions;
import com.pulumi.alicloud.kms.inputs.GetInstancesArgs;
import com.pulumi.alicloud.kms.inputs.GetKeysArgs;
import com.pulumi.alicloud.kms.Secret;
import com.pulumi.alicloud.kms.SecretArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.ArrayList;
import java.util.Arrays;
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 config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
final var default = KmsFunctions.getInstances(GetInstancesArgs.builder()
.ids("kst-bjj62d8f5e0sgtx8h****")
.build());
final var defaultGetKeys = KmsFunctions.getKeys(GetKeysArgs.builder()
.ids("key-gzz63ff0db5hg3qje****")
.build());
var ram = new Secret("ram", SecretArgs.builder()
.secretName("$Auto")
.secretType("RAMCredentials")
.secretData(serializeJson(
jsonObject(
jsonProperty("AccessKeys", jsonArray(jsonObject(
jsonProperty("AccessKeyId", "LTAI********************"),
jsonProperty("AccessKeySecret", "YourAccessKeySecret")
)))
)))
.versionId("v1")
.dkmsInstanceId(default_.instances()[0].instanceId())
.encryptionKeyId(defaultGetKeys.keys()[0].id())
.extendedConfig(serializeJson(
jsonObject(
jsonProperty("SecretSubType", "RamUserAccessKey"),
jsonProperty("UserName", "ram_user")
)))
.forceDeleteWithoutRecovery(true)
.build());
}
}
configuration:
name:
type: string
default: terraform-example
resources:
ram:
type: alicloud:kms:Secret
properties:
secretName: $Auto
secretType: RAMCredentials
secretData:
fn::toJSON:
AccessKeys:
- AccessKeyId: LTAI********************
AccessKeySecret: YourAccessKeySecret
versionId: v1
dkmsInstanceId: ${default.instances[0].instanceId}
encryptionKeyId: ${defaultGetKeys.keys[0].id}
extendedConfig:
fn::toJSON:
SecretSubType: RamUserAccessKey
UserName: ram_user
forceDeleteWithoutRecovery: true
variables:
default:
fn::invoke:
function: alicloud:kms:getInstances
arguments:
ids:
- kst-bjj62d8f5e0sgtx8h****
defaultGetKeys:
fn::invoke:
function: alicloud:kms:getKeys
arguments:
ids:
- key-gzz63ff0db5hg3qje****
terraform {
required_providers {
alicloud = {
source = "pulumi/alicloud"
}
}
}
data "alicloud_kms_instances" "default" {
ids = ["kst-bjj62d8f5e0sgtx8h****"]
}
data "alicloud_kms_keys" "defaultGetKeys" {
ids = ["key-gzz63ff0db5hg3qje****"]
}
resource "alicloud_kms_secret" "ram" {
lifecycle {
create_before_destroy = true
}
secret_name = "$Auto"
secret_type = "RAMCredentials"
secret_data = jsonencode({
"AccessKeys" = [{
"AccessKeyId" = "LTAI********************"
"AccessKeySecret" = "YourAccessKeySecret"
}]
})
version_id = "v1"
dkms_instance_id = data.alicloud_kms_instances.default.instances[0].instance_id
encryption_key_id = data.alicloud_kms_keys.defaultGetKeys.keys[0].id
extended_config = jsonencode({
"SecretSubType" = "RamUserAccessKey"
"UserName" = "ram_user"
})
force_delete_without_recovery = true
}
variable "name" {
type = string
default = "terraform-example"
}
Create an ECS secret
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const _default = alicloud.kms.getInstances({
ids: ["kst-bjj62d8f5e0sgtx8h****"],
});
const defaultGetKeys = alicloud.kms.getKeys({
ids: ["key-gzz63ff0db5hg3qje****"],
});
const ecs = new alicloud.kms.Secret("ecs", {
secretName: `acs/ecs/${name}`,
secretType: "ECS",
secretData: JSON.stringify({
UserName: "root",
Password: "YourPassword12345!",
}),
versionId: "v1",
dkmsInstanceId: _default.then(_default => _default.instances?.[0]?.instanceId),
encryptionKeyId: defaultGetKeys.then(defaultGetKeys => defaultGetKeys.keys?.[0]?.id),
extendedConfig: JSON.stringify({
SecretSubType: "Password",
RegionId: "cn-hangzhou",
InstanceId: "i-bp1b3dd3a506e****",
}),
forceDeleteWithoutRecovery: true,
});
import pulumi
import json
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = alicloud.kms.get_instances(ids=["kst-bjj62d8f5e0sgtx8h****"])
default_get_keys = alicloud.kms.get_keys(ids=["key-gzz63ff0db5hg3qje****"])
ecs = alicloud.kms.Secret("ecs",
secret_name=f"acs/ecs/{name}",
secret_type="ECS",
secret_data=json.dumps({
"UserName": "root",
"Password": "YourPassword12345!",
}),
version_id="v1",
dkms_instance_id=default.instances[0].instance_id,
encryption_key_id=default_get_keys.keys[0].id,
extended_config=json.dumps({
"SecretSubType": "Password",
"RegionId": "cn-hangzhou",
"InstanceId": "i-bp1b3dd3a506e****",
}),
force_delete_without_recovery=True)
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-alicloud/sdk/v4/go/alicloud/kms"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := kms.GetInstances(ctx, &kms.GetInstancesArgs{
Ids: []string{
"kst-bjj62d8f5e0sgtx8h****",
},
}, nil)
if err != nil {
return err
}
defaultGetKeys, err := kms.GetKeys(ctx, &kms.GetKeysArgs{
Ids: []string{
"key-gzz63ff0db5hg3qje****",
},
}, nil)
if err != nil {
return err
}
tmpJSON0, err := json.Marshal(map[string]string{
"UserName": "root",
"Password": "YourPassword12345!",
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
tmpJSON1, err := json.Marshal(map[string]string{
"SecretSubType": "Password",
"RegionId": "cn-hangzhou",
"InstanceId": "i-bp1b3dd3a506e****",
})
if err != nil {
return err
}
json1 := string(tmpJSON1)
_, err = kms.NewSecret(ctx, "ecs", &kms.SecretArgs{
SecretName: pulumi.Sprintf("acs/ecs/%v", name),
SecretType: pulumi.String("ECS"),
SecretData: pulumi.String(json0),
VersionId: pulumi.String("v1"),
DkmsInstanceId: pulumi.String(_default.Instances[0].InstanceId),
EncryptionKeyId: pulumi.String(defaultGetKeys.Keys[0].Id),
ExtendedConfig: pulumi.String(json1),
ForceDeleteWithoutRecovery: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var @default = AliCloud.Kms.GetInstances.Invoke(new()
{
Ids = new[]
{
"kst-bjj62d8f5e0sgtx8h****",
},
});
var defaultGetKeys = AliCloud.Kms.GetKeys.Invoke(new()
{
Ids = new[]
{
"key-gzz63ff0db5hg3qje****",
},
});
var ecs = new AliCloud.Kms.Secret("ecs", new()
{
SecretName = $"acs/ecs/{name}",
SecretType = "ECS",
SecretData = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["UserName"] = "root",
["Password"] = "YourPassword12345!",
}),
VersionId = "v1",
DkmsInstanceId = @default.Apply(@default => @default.Apply(getInstancesResult => getInstancesResult.Instances[0]?.InstanceId)),
EncryptionKeyId = defaultGetKeys.Apply(getKeysResult => getKeysResult.Keys[0]?.Id),
ExtendedConfig = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["SecretSubType"] = "Password",
["RegionId"] = "cn-hangzhou",
["InstanceId"] = "i-bp1b3dd3a506e****",
}),
ForceDeleteWithoutRecovery = true,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.kms.KmsFunctions;
import com.pulumi.alicloud.kms.inputs.GetInstancesArgs;
import com.pulumi.alicloud.kms.inputs.GetKeysArgs;
import com.pulumi.alicloud.kms.Secret;
import com.pulumi.alicloud.kms.SecretArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.ArrayList;
import java.util.Arrays;
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 config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
final var default = KmsFunctions.getInstances(GetInstancesArgs.builder()
.ids("kst-bjj62d8f5e0sgtx8h****")
.build());
final var defaultGetKeys = KmsFunctions.getKeys(GetKeysArgs.builder()
.ids("key-gzz63ff0db5hg3qje****")
.build());
var ecs = new Secret("ecs", SecretArgs.builder()
.secretName(String.format("acs/ecs/%s", name))
.secretType("ECS")
.secretData(serializeJson(
jsonObject(
jsonProperty("UserName", "root"),
jsonProperty("Password", "YourPassword12345!")
)))
.versionId("v1")
.dkmsInstanceId(default_.instances()[0].instanceId())
.encryptionKeyId(defaultGetKeys.keys()[0].id())
.extendedConfig(serializeJson(
jsonObject(
jsonProperty("SecretSubType", "Password"),
jsonProperty("RegionId", "cn-hangzhou"),
jsonProperty("InstanceId", "i-bp1b3dd3a506e****")
)))
.forceDeleteWithoutRecovery(true)
.build());
}
}
configuration:
name:
type: string
default: terraform-example
resources:
ecs:
type: alicloud:kms:Secret
properties:
secretName: acs/ecs/${name}
secretType: ECS
secretData:
fn::toJSON:
UserName: root
Password: YourPassword12345!
versionId: v1
dkmsInstanceId: ${default.instances[0].instanceId}
encryptionKeyId: ${defaultGetKeys.keys[0].id}
extendedConfig:
fn::toJSON:
SecretSubType: Password
RegionId: cn-hangzhou
InstanceId: i-bp1b3dd3a506e****
forceDeleteWithoutRecovery: true
variables:
default:
fn::invoke:
function: alicloud:kms:getInstances
arguments:
ids:
- kst-bjj62d8f5e0sgtx8h****
defaultGetKeys:
fn::invoke:
function: alicloud:kms:getKeys
arguments:
ids:
- key-gzz63ff0db5hg3qje****
terraform {
required_providers {
alicloud = {
source = "pulumi/alicloud"
}
}
}
data "alicloud_kms_instances" "default" {
ids = ["kst-bjj62d8f5e0sgtx8h****"]
}
data "alicloud_kms_keys" "defaultGetKeys" {
ids = ["key-gzz63ff0db5hg3qje****"]
}
resource "alicloud_kms_secret" "ecs" {
lifecycle {
create_before_destroy = true
}
secret_name ="acs/ecs/${var.name}"
secret_type = "ECS"
secret_data = jsonencode({
"UserName" = "root"
"Password" = "YourPassword12345!"
})
version_id = "v1"
dkms_instance_id = data.alicloud_kms_instances.default.instances[0].instance_id
encryption_key_id = data.alicloud_kms_keys.defaultGetKeys.keys[0].id
extended_config = jsonencode({
"SecretSubType" = "Password"
"RegionId" = "cn-hangzhou"
"InstanceId" = "i-bp1b3dd3a506e****"
})
force_delete_without_recovery = true
}
variable "name" {
type = string
default = "terraform-example"
}
Create a PolarDB secret
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const _default = alicloud.kms.getInstances({
ids: ["kst-bjj62d8f5e0sgtx8h****"],
});
const defaultGetKeys = alicloud.kms.getKeys({
ids: ["key-gzz63ff0db5hg3qje****"],
});
const polardb = new alicloud.kms.Secret("polardb", {
secretName: name,
secretType: "PolarDB",
secretData: "$Auto",
versionId: "v1",
dkmsInstanceId: _default.then(_default => _default.instances?.[0]?.instanceId),
encryptionKeyId: defaultGetKeys.then(defaultGetKeys => defaultGetKeys.keys?.[0]?.id),
extendedConfig: JSON.stringify({
SecretSubType: "DoubleUsers",
RegionId: "cn-hangzhou",
DBClusterId: "pc-bp1b3dd3a506e****",
DBType: "MySQL",
AccountName: "polardb_user",
CloneAccountName: "polardb_user_clone",
AccountType: "Normal",
AccountPrivilege: "ReadOnly",
DBName: "testdb",
}),
forceDeleteWithoutRecovery: true,
});
import pulumi
import json
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = alicloud.kms.get_instances(ids=["kst-bjj62d8f5e0sgtx8h****"])
default_get_keys = alicloud.kms.get_keys(ids=["key-gzz63ff0db5hg3qje****"])
polardb = alicloud.kms.Secret("polardb",
secret_name=name,
secret_type="PolarDB",
secret_data="$Auto",
version_id="v1",
dkms_instance_id=default.instances[0].instance_id,
encryption_key_id=default_get_keys.keys[0].id,
extended_config=json.dumps({
"SecretSubType": "DoubleUsers",
"RegionId": "cn-hangzhou",
"DBClusterId": "pc-bp1b3dd3a506e****",
"DBType": "MySQL",
"AccountName": "polardb_user",
"CloneAccountName": "polardb_user_clone",
"AccountType": "Normal",
"AccountPrivilege": "ReadOnly",
"DBName": "testdb",
}),
force_delete_without_recovery=True)
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-alicloud/sdk/v4/go/alicloud/kms"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := kms.GetInstances(ctx, &kms.GetInstancesArgs{
Ids: []string{
"kst-bjj62d8f5e0sgtx8h****",
},
}, nil)
if err != nil {
return err
}
defaultGetKeys, err := kms.GetKeys(ctx, &kms.GetKeysArgs{
Ids: []string{
"key-gzz63ff0db5hg3qje****",
},
}, nil)
if err != nil {
return err
}
tmpJSON0, err := json.Marshal(map[string]string{
"SecretSubType": "DoubleUsers",
"RegionId": "cn-hangzhou",
"DBClusterId": "pc-bp1b3dd3a506e****",
"DBType": "MySQL",
"AccountName": "polardb_user",
"CloneAccountName": "polardb_user_clone",
"AccountType": "Normal",
"AccountPrivilege": "ReadOnly",
"DBName": "testdb",
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = kms.NewSecret(ctx, "polardb", &kms.SecretArgs{
SecretName: pulumi.String(name),
SecretType: pulumi.String("PolarDB"),
SecretData: pulumi.String("$Auto"),
VersionId: pulumi.String("v1"),
DkmsInstanceId: pulumi.String(_default.Instances[0].InstanceId),
EncryptionKeyId: pulumi.String(defaultGetKeys.Keys[0].Id),
ExtendedConfig: pulumi.String(json0),
ForceDeleteWithoutRecovery: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "terraform-example";
var @default = AliCloud.Kms.GetInstances.Invoke(new()
{
Ids = new[]
{
"kst-bjj62d8f5e0sgtx8h****",
},
});
var defaultGetKeys = AliCloud.Kms.GetKeys.Invoke(new()
{
Ids = new[]
{
"key-gzz63ff0db5hg3qje****",
},
});
var polardb = new AliCloud.Kms.Secret("polardb", new()
{
SecretName = name,
SecretType = "PolarDB",
SecretData = "$Auto",
VersionId = "v1",
DkmsInstanceId = @default.Apply(@default => @default.Apply(getInstancesResult => getInstancesResult.Instances[0]?.InstanceId)),
EncryptionKeyId = defaultGetKeys.Apply(getKeysResult => getKeysResult.Keys[0]?.Id),
ExtendedConfig = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["SecretSubType"] = "DoubleUsers",
["RegionId"] = "cn-hangzhou",
["DBClusterId"] = "pc-bp1b3dd3a506e****",
["DBType"] = "MySQL",
["AccountName"] = "polardb_user",
["CloneAccountName"] = "polardb_user_clone",
["AccountType"] = "Normal",
["AccountPrivilege"] = "ReadOnly",
["DBName"] = "testdb",
}),
ForceDeleteWithoutRecovery = true,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.kms.KmsFunctions;
import com.pulumi.alicloud.kms.inputs.GetInstancesArgs;
import com.pulumi.alicloud.kms.inputs.GetKeysArgs;
import com.pulumi.alicloud.kms.Secret;
import com.pulumi.alicloud.kms.SecretArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.ArrayList;
import java.util.Arrays;
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 config = ctx.config();
final var name = config.get("name").orElse("terraform-example");
final var default = KmsFunctions.getInstances(GetInstancesArgs.builder()
.ids("kst-bjj62d8f5e0sgtx8h****")
.build());
final var defaultGetKeys = KmsFunctions.getKeys(GetKeysArgs.builder()
.ids("key-gzz63ff0db5hg3qje****")
.build());
var polardb = new Secret("polardb", SecretArgs.builder()
.secretName(name)
.secretType("PolarDB")
.secretData("$Auto")
.versionId("v1")
.dkmsInstanceId(default_.instances()[0].instanceId())
.encryptionKeyId(defaultGetKeys.keys()[0].id())
.extendedConfig(serializeJson(
jsonObject(
jsonProperty("SecretSubType", "DoubleUsers"),
jsonProperty("RegionId", "cn-hangzhou"),
jsonProperty("DBClusterId", "pc-bp1b3dd3a506e****"),
jsonProperty("DBType", "MySQL"),
jsonProperty("AccountName", "polardb_user"),
jsonProperty("CloneAccountName", "polardb_user_clone"),
jsonProperty("AccountType", "Normal"),
jsonProperty("AccountPrivilege", "ReadOnly"),
jsonProperty("DBName", "testdb")
)))
.forceDeleteWithoutRecovery(true)
.build());
}
}
configuration:
name:
type: string
default: terraform-example
resources:
polardb:
type: alicloud:kms:Secret
properties:
secretName: ${name}
secretType: PolarDB
secretData: $Auto
versionId: v1
dkmsInstanceId: ${default.instances[0].instanceId}
encryptionKeyId: ${defaultGetKeys.keys[0].id}
extendedConfig:
fn::toJSON:
SecretSubType: DoubleUsers
RegionId: cn-hangzhou
DBClusterId: pc-bp1b3dd3a506e****
DBType: MySQL
AccountName: polardb_user
CloneAccountName: polardb_user_clone
AccountType: Normal
AccountPrivilege: ReadOnly
DBName: testdb
forceDeleteWithoutRecovery: true
variables:
default:
fn::invoke:
function: alicloud:kms:getInstances
arguments:
ids:
- kst-bjj62d8f5e0sgtx8h****
defaultGetKeys:
fn::invoke:
function: alicloud:kms:getKeys
arguments:
ids:
- key-gzz63ff0db5hg3qje****
terraform {
required_providers {
alicloud = {
source = "pulumi/alicloud"
}
}
}
data "alicloud_kms_instances" "default" {
ids = ["kst-bjj62d8f5e0sgtx8h****"]
}
data "alicloud_kms_keys" "defaultGetKeys" {
ids = ["key-gzz63ff0db5hg3qje****"]
}
resource "alicloud_kms_secret" "polardb" {
lifecycle {
create_before_destroy = true
}
secret_name = var.name
secret_type = "PolarDB"
secret_data = "$Auto"
version_id = "v1"
dkms_instance_id = data.alicloud_kms_instances.default.instances[0].instance_id
encryption_key_id = data.alicloud_kms_keys.defaultGetKeys.keys[0].id
extended_config = jsonencode({
"SecretSubType" = "DoubleUsers"
"RegionId" = "cn-hangzhou"
"DBClusterId" = "pc-bp1b3dd3a506e****"
"DBType" = "MySQL"
"AccountName" = "polardb_user"
"CloneAccountName" = "polardb_user_clone"
"AccountType" = "Normal"
"AccountPrivilege" = "ReadOnly"
"DBName" = "testdb"
})
force_delete_without_recovery = true
}
variable "name" {
type = string
default = "terraform-example"
}
📚 Need more examples? VIEW MORE EXAMPLES
Create Secret Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Secret(name: string, args: SecretArgs, opts?: CustomResourceOptions);@overload
def Secret(resource_name: str,
args: SecretArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Secret(resource_name: str,
opts: Optional[ResourceOptions] = None,
secret_data: Optional[str] = None,
version_id: Optional[str] = None,
secret_name: Optional[str] = None,
rotation_interval: Optional[str] = None,
extended_config: Optional[str] = None,
force_delete_without_recovery: Optional[bool] = None,
policy: Optional[str] = None,
recovery_window_in_days: Optional[int] = None,
description: Optional[str] = None,
encryption_key_id: Optional[str] = None,
secret_data_type: Optional[str] = None,
enable_automatic_rotation: Optional[bool] = None,
secret_type: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
dkms_instance_id: Optional[str] = None,
version_stages: Optional[Sequence[str]] = None)func NewSecret(ctx *Context, name string, args SecretArgs, opts ...ResourceOption) (*Secret, error)public Secret(string name, SecretArgs args, CustomResourceOptions? opts = null)
public Secret(String name, SecretArgs args)
public Secret(String name, SecretArgs args, CustomResourceOptions options)
type: alicloud:kms:Secret
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "alicloud_kms_secret" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args SecretArgs
- 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 SecretArgs
- 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 SecretArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SecretArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SecretArgs
- 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 alicloudSecretResource = new AliCloud.Kms.Secret("alicloudSecretResource", new()
{
SecretData = "string",
VersionId = "string",
SecretName = "string",
RotationInterval = "string",
ExtendedConfig = "string",
ForceDeleteWithoutRecovery = false,
Policy = "string",
RecoveryWindowInDays = 0,
Description = "string",
EncryptionKeyId = "string",
SecretDataType = "string",
EnableAutomaticRotation = false,
SecretType = "string",
Tags =
{
{ "string", "string" },
},
DkmsInstanceId = "string",
VersionStages = new[]
{
"string",
},
});
example, err := kms.NewSecret(ctx, "alicloudSecretResource", &kms.SecretArgs{
SecretData: pulumi.String("string"),
VersionId: pulumi.String("string"),
SecretName: pulumi.String("string"),
RotationInterval: pulumi.String("string"),
ExtendedConfig: pulumi.String("string"),
ForceDeleteWithoutRecovery: pulumi.Bool(false),
Policy: pulumi.String("string"),
RecoveryWindowInDays: pulumi.Int(0),
Description: pulumi.String("string"),
EncryptionKeyId: pulumi.String("string"),
SecretDataType: pulumi.String("string"),
EnableAutomaticRotation: pulumi.Bool(false),
SecretType: pulumi.String("string"),
Tags: pulumi.StringMap{
"string": pulumi.String("string"),
},
DkmsInstanceId: pulumi.String("string"),
VersionStages: pulumi.StringArray{
pulumi.String("string"),
},
})
resource "alicloud_kms_secret" "alicloudSecretResource" {
lifecycle {
create_before_destroy = true
}
secret_data = "string"
version_id = "string"
secret_name = "string"
rotation_interval = "string"
extended_config = "string"
force_delete_without_recovery = false
policy = "string"
recovery_window_in_days = 0
description = "string"
encryption_key_id = "string"
secret_data_type = "string"
enable_automatic_rotation = false
secret_type = "string"
tags = {
"string" = "string"
}
dkms_instance_id = "string"
version_stages = ["string"]
}
var alicloudSecretResource = new com.pulumi.alicloud.kms.Secret("alicloudSecretResource", com.pulumi.alicloud.kms.SecretArgs.builder()
.secretData("string")
.versionId("string")
.secretName("string")
.rotationInterval("string")
.extendedConfig("string")
.forceDeleteWithoutRecovery(false)
.policy("string")
.recoveryWindowInDays(0)
.description("string")
.encryptionKeyId("string")
.secretDataType("string")
.enableAutomaticRotation(false)
.secretType("string")
.tags(Map.of("string", "string"))
.dkmsInstanceId("string")
.versionStages("string")
.build());
alicloud_secret_resource = alicloud.kms.Secret("alicloudSecretResource",
secret_data="string",
version_id="string",
secret_name="string",
rotation_interval="string",
extended_config="string",
force_delete_without_recovery=False,
policy="string",
recovery_window_in_days=0,
description="string",
encryption_key_id="string",
secret_data_type="string",
enable_automatic_rotation=False,
secret_type="string",
tags={
"string": "string",
},
dkms_instance_id="string",
version_stages=["string"])
const alicloudSecretResource = new alicloud.kms.Secret("alicloudSecretResource", {
secretData: "string",
versionId: "string",
secretName: "string",
rotationInterval: "string",
extendedConfig: "string",
forceDeleteWithoutRecovery: false,
policy: "string",
recoveryWindowInDays: 0,
description: "string",
encryptionKeyId: "string",
secretDataType: "string",
enableAutomaticRotation: false,
secretType: "string",
tags: {
string: "string",
},
dkmsInstanceId: "string",
versionStages: ["string"],
});
type: alicloud:kms:Secret
properties:
description: string
dkmsInstanceId: string
enableAutomaticRotation: false
encryptionKeyId: string
extendedConfig: string
forceDeleteWithoutRecovery: false
policy: string
recoveryWindowInDays: 0
rotationInterval: string
secretData: string
secretDataType: string
secretName: string
secretType: string
tags:
string: string
versionId: string
versionStages:
- string
Secret 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 Secret resource accepts the following input properties:
- Secret
Data string - The data of the secret. NOTE: From version 1.204.1,
secretDataupdating diff will be ignored whensecretTypeis notGeneric. The expected format ofsecretDatadepends onsecretType:Generic: any custom string.Rds: a JSON string in the form{"Accounts":[{"AccountName":"<rds-account-name>","AccountPassword":"<rds-account-password>"}]}.RAMCredentials: a JSON string in the form{"AccessKeys":[{"AccessKeyId":"<access-key-id>","AccessKeySecret":"<access-key-secret>"}]}.ECS: a JSON string. Whenextended_config.SecretSubTypeisPassword, use{"UserName":"<user-name>","Password":"<password>"}. WhenSecretSubTypeisSSHKey, use{"UserName":"<user-name>","PublicKey":"<public-key>","PrivateKey":"<private-key>"}.RedisandPolarDB: use the literal string$Auto.
- Secret
Name string - The name of the secret. For more information, see How to use it.
- Version
Id string - The version number of the initial version.
- Description string
- The description of the secret.
- Dkms
Instance stringId - The ID of the KMS instance. NOTE: In KMS 3.0, this parameter is required.
- Enable
Automatic boolRotation - Specifies whether to enable automatic rotation. Default value:
false. Valid values:true,false. - Encryption
Key stringId - The ID of the KMS key used to encrypt the secret value. The key and the secret must belong to the same KMS instance, and the key must be a symmetric key. NOTE: In KMS 3.0, this parameter is required.
- Extended
Config string - The extended configuration of the secret. This parameter is required when
secretTypeisRds,Redis,RAMCredentials,ECSorPolarDB. The value is a JSON string. For more information, see How to use it. - Force
Delete boolWithout Recovery - Specifies whether to immediately delete a secret. Default value:
false. Valid values:true,false. - Policy string
- The content of the secret policy. The value is in the JSON format. The value can be up to 32,768 bytes in length. For more information, see How to use it.
- Recovery
Window intIn Days - Specifies the recovery period of the secret if you do not forcibly delete it. Unit: Days. Default value:
30. Valid values:7to30. NOTE: IfforceDeleteWithoutRecoveryis set totrue,recoveryWindowInDayswill be ignored. - Rotation
Interval string - The interval for automatic rotation. For more information, see How to use it.
- Secret
Data stringType - The type of the secret value. Default value:
text. Valid values:text,binary. - Secret
Type string - The type of the secret. Valid values:
Generic: Generic secret.Rds: ApsaraDB RDS secret.Redis: (Available since v1.253.0) ApsaraDB for Redis secret.RAMCredentials: RAM secret.ECS: ECS secret.PolarDB: (Available since v1.253.0) PolarDB secret.
- Dictionary<string, string>
- A mapping of tags to assign to the resource.
- Version
Stages List<string> - The stage label that is used to mark the new version.
- Secret
Data string - The data of the secret. NOTE: From version 1.204.1,
secretDataupdating diff will be ignored whensecretTypeis notGeneric. The expected format ofsecretDatadepends onsecretType:Generic: any custom string.Rds: a JSON string in the form{"Accounts":[{"AccountName":"<rds-account-name>","AccountPassword":"<rds-account-password>"}]}.RAMCredentials: a JSON string in the form{"AccessKeys":[{"AccessKeyId":"<access-key-id>","AccessKeySecret":"<access-key-secret>"}]}.ECS: a JSON string. Whenextended_config.SecretSubTypeisPassword, use{"UserName":"<user-name>","Password":"<password>"}. WhenSecretSubTypeisSSHKey, use{"UserName":"<user-name>","PublicKey":"<public-key>","PrivateKey":"<private-key>"}.RedisandPolarDB: use the literal string$Auto.
- Secret
Name string - The name of the secret. For more information, see How to use it.
- Version
Id string - The version number of the initial version.
- Description string
- The description of the secret.
- Dkms
Instance stringId - The ID of the KMS instance. NOTE: In KMS 3.0, this parameter is required.
- Enable
Automatic boolRotation - Specifies whether to enable automatic rotation. Default value:
false. Valid values:true,false. - Encryption
Key stringId - The ID of the KMS key used to encrypt the secret value. The key and the secret must belong to the same KMS instance, and the key must be a symmetric key. NOTE: In KMS 3.0, this parameter is required.
- Extended
Config string - The extended configuration of the secret. This parameter is required when
secretTypeisRds,Redis,RAMCredentials,ECSorPolarDB. The value is a JSON string. For more information, see How to use it. - Force
Delete boolWithout Recovery - Specifies whether to immediately delete a secret. Default value:
false. Valid values:true,false. - Policy string
- The content of the secret policy. The value is in the JSON format. The value can be up to 32,768 bytes in length. For more information, see How to use it.
- Recovery
Window intIn Days - Specifies the recovery period of the secret if you do not forcibly delete it. Unit: Days. Default value:
30. Valid values:7to30. NOTE: IfforceDeleteWithoutRecoveryis set totrue,recoveryWindowInDayswill be ignored. - Rotation
Interval string - The interval for automatic rotation. For more information, see How to use it.
- Secret
Data stringType - The type of the secret value. Default value:
text. Valid values:text,binary. - Secret
Type string - The type of the secret. Valid values:
Generic: Generic secret.Rds: ApsaraDB RDS secret.Redis: (Available since v1.253.0) ApsaraDB for Redis secret.RAMCredentials: RAM secret.ECS: ECS secret.PolarDB: (Available since v1.253.0) PolarDB secret.
- map[string]string
- A mapping of tags to assign to the resource.
- Version
Stages []string - The stage label that is used to mark the new version.
- secret_
data string - The data of the secret. NOTE: From version 1.204.1,
secretDataupdating diff will be ignored whensecretTypeis notGeneric. The expected format ofsecretDatadepends onsecretType:Generic: any custom string.Rds: a JSON string in the form{"Accounts":[{"AccountName":"<rds-account-name>","AccountPassword":"<rds-account-password>"}]}.RAMCredentials: a JSON string in the form{"AccessKeys":[{"AccessKeyId":"<access-key-id>","AccessKeySecret":"<access-key-secret>"}]}.ECS: a JSON string. Whenextended_config.SecretSubTypeisPassword, use{"UserName":"<user-name>","Password":"<password>"}. WhenSecretSubTypeisSSHKey, use{"UserName":"<user-name>","PublicKey":"<public-key>","PrivateKey":"<private-key>"}.RedisandPolarDB: use the literal string$Auto.
- secret_
name string - The name of the secret. For more information, see How to use it.
- version_
id string - The version number of the initial version.
- description string
- The description of the secret.
- dkms_
instance_ stringid - The ID of the KMS instance. NOTE: In KMS 3.0, this parameter is required.
- enable_
automatic_ boolrotation - Specifies whether to enable automatic rotation. Default value:
false. Valid values:true,false. - encryption_
key_ stringid - The ID of the KMS key used to encrypt the secret value. The key and the secret must belong to the same KMS instance, and the key must be a symmetric key. NOTE: In KMS 3.0, this parameter is required.
- extended_
config string - The extended configuration of the secret. This parameter is required when
secretTypeisRds,Redis,RAMCredentials,ECSorPolarDB. The value is a JSON string. For more information, see How to use it. - force_
delete_ boolwithout_ recovery - Specifies whether to immediately delete a secret. Default value:
false. Valid values:true,false. - policy string
- The content of the secret policy. The value is in the JSON format. The value can be up to 32,768 bytes in length. For more information, see How to use it.
- recovery_
window_ numberin_ days - Specifies the recovery period of the secret if you do not forcibly delete it. Unit: Days. Default value:
30. Valid values:7to30. NOTE: IfforceDeleteWithoutRecoveryis set totrue,recoveryWindowInDayswill be ignored. - rotation_
interval string - The interval for automatic rotation. For more information, see How to use it.
- secret_
data_ stringtype - The type of the secret value. Default value:
text. Valid values:text,binary. - secret_
type string - The type of the secret. Valid values:
Generic: Generic secret.Rds: ApsaraDB RDS secret.Redis: (Available since v1.253.0) ApsaraDB for Redis secret.RAMCredentials: RAM secret.ECS: ECS secret.PolarDB: (Available since v1.253.0) PolarDB secret.
- map(string)
- A mapping of tags to assign to the resource.
- version_
stages list(string) - The stage label that is used to mark the new version.
- secret
Data String - The data of the secret. NOTE: From version 1.204.1,
secretDataupdating diff will be ignored whensecretTypeis notGeneric. The expected format ofsecretDatadepends onsecretType:Generic: any custom string.Rds: a JSON string in the form{"Accounts":[{"AccountName":"<rds-account-name>","AccountPassword":"<rds-account-password>"}]}.RAMCredentials: a JSON string in the form{"AccessKeys":[{"AccessKeyId":"<access-key-id>","AccessKeySecret":"<access-key-secret>"}]}.ECS: a JSON string. Whenextended_config.SecretSubTypeisPassword, use{"UserName":"<user-name>","Password":"<password>"}. WhenSecretSubTypeisSSHKey, use{"UserName":"<user-name>","PublicKey":"<public-key>","PrivateKey":"<private-key>"}.RedisandPolarDB: use the literal string$Auto.
- secret
Name String - The name of the secret. For more information, see How to use it.
- version
Id String - The version number of the initial version.
- description String
- The description of the secret.
- dkms
Instance StringId - The ID of the KMS instance. NOTE: In KMS 3.0, this parameter is required.
- enable
Automatic BooleanRotation - Specifies whether to enable automatic rotation. Default value:
false. Valid values:true,false. - encryption
Key StringId - The ID of the KMS key used to encrypt the secret value. The key and the secret must belong to the same KMS instance, and the key must be a symmetric key. NOTE: In KMS 3.0, this parameter is required.
- extended
Config String - The extended configuration of the secret. This parameter is required when
secretTypeisRds,Redis,RAMCredentials,ECSorPolarDB. The value is a JSON string. For more information, see How to use it. - force
Delete BooleanWithout Recovery - Specifies whether to immediately delete a secret. Default value:
false. Valid values:true,false. - policy String
- The content of the secret policy. The value is in the JSON format. The value can be up to 32,768 bytes in length. For more information, see How to use it.
- recovery
Window IntegerIn Days - Specifies the recovery period of the secret if you do not forcibly delete it. Unit: Days. Default value:
30. Valid values:7to30. NOTE: IfforceDeleteWithoutRecoveryis set totrue,recoveryWindowInDayswill be ignored. - rotation
Interval String - The interval for automatic rotation. For more information, see How to use it.
- secret
Data StringType - The type of the secret value. Default value:
text. Valid values:text,binary. - secret
Type String - The type of the secret. Valid values:
Generic: Generic secret.Rds: ApsaraDB RDS secret.Redis: (Available since v1.253.0) ApsaraDB for Redis secret.RAMCredentials: RAM secret.ECS: ECS secret.PolarDB: (Available since v1.253.0) PolarDB secret.
- Map<String,String>
- A mapping of tags to assign to the resource.
- version
Stages List<String> - The stage label that is used to mark the new version.
- secret
Data string - The data of the secret. NOTE: From version 1.204.1,
secretDataupdating diff will be ignored whensecretTypeis notGeneric. The expected format ofsecretDatadepends onsecretType:Generic: any custom string.Rds: a JSON string in the form{"Accounts":[{"AccountName":"<rds-account-name>","AccountPassword":"<rds-account-password>"}]}.RAMCredentials: a JSON string in the form{"AccessKeys":[{"AccessKeyId":"<access-key-id>","AccessKeySecret":"<access-key-secret>"}]}.ECS: a JSON string. Whenextended_config.SecretSubTypeisPassword, use{"UserName":"<user-name>","Password":"<password>"}. WhenSecretSubTypeisSSHKey, use{"UserName":"<user-name>","PublicKey":"<public-key>","PrivateKey":"<private-key>"}.RedisandPolarDB: use the literal string$Auto.
- secret
Name string - The name of the secret. For more information, see How to use it.
- version
Id string - The version number of the initial version.
- description string
- The description of the secret.
- dkms
Instance stringId - The ID of the KMS instance. NOTE: In KMS 3.0, this parameter is required.
- enable
Automatic booleanRotation - Specifies whether to enable automatic rotation. Default value:
false. Valid values:true,false. - encryption
Key stringId - The ID of the KMS key used to encrypt the secret value. The key and the secret must belong to the same KMS instance, and the key must be a symmetric key. NOTE: In KMS 3.0, this parameter is required.
- extended
Config string - The extended configuration of the secret. This parameter is required when
secretTypeisRds,Redis,RAMCredentials,ECSorPolarDB. The value is a JSON string. For more information, see How to use it. - force
Delete booleanWithout Recovery - Specifies whether to immediately delete a secret. Default value:
false. Valid values:true,false. - policy string
- The content of the secret policy. The value is in the JSON format. The value can be up to 32,768 bytes in length. For more information, see How to use it.
- recovery
Window numberIn Days - Specifies the recovery period of the secret if you do not forcibly delete it. Unit: Days. Default value:
30. Valid values:7to30. NOTE: IfforceDeleteWithoutRecoveryis set totrue,recoveryWindowInDayswill be ignored. - rotation
Interval string - The interval for automatic rotation. For more information, see How to use it.
- secret
Data stringType - The type of the secret value. Default value:
text. Valid values:text,binary. - secret
Type string - The type of the secret. Valid values:
Generic: Generic secret.Rds: ApsaraDB RDS secret.Redis: (Available since v1.253.0) ApsaraDB for Redis secret.RAMCredentials: RAM secret.ECS: ECS secret.PolarDB: (Available since v1.253.0) PolarDB secret.
- {[key: string]: string}
- A mapping of tags to assign to the resource.
- version
Stages string[] - The stage label that is used to mark the new version.
- secret_
data str - The data of the secret. NOTE: From version 1.204.1,
secretDataupdating diff will be ignored whensecretTypeis notGeneric. The expected format ofsecretDatadepends onsecretType:Generic: any custom string.Rds: a JSON string in the form{"Accounts":[{"AccountName":"<rds-account-name>","AccountPassword":"<rds-account-password>"}]}.RAMCredentials: a JSON string in the form{"AccessKeys":[{"AccessKeyId":"<access-key-id>","AccessKeySecret":"<access-key-secret>"}]}.ECS: a JSON string. Whenextended_config.SecretSubTypeisPassword, use{"UserName":"<user-name>","Password":"<password>"}. WhenSecretSubTypeisSSHKey, use{"UserName":"<user-name>","PublicKey":"<public-key>","PrivateKey":"<private-key>"}.RedisandPolarDB: use the literal string$Auto.
- secret_
name str - The name of the secret. For more information, see How to use it.
- version_
id str - The version number of the initial version.
- description str
- The description of the secret.
- dkms_
instance_ strid - The ID of the KMS instance. NOTE: In KMS 3.0, this parameter is required.
- enable_
automatic_ boolrotation - Specifies whether to enable automatic rotation. Default value:
false. Valid values:true,false. - encryption_
key_ strid - The ID of the KMS key used to encrypt the secret value. The key and the secret must belong to the same KMS instance, and the key must be a symmetric key. NOTE: In KMS 3.0, this parameter is required.
- extended_
config str - The extended configuration of the secret. This parameter is required when
secretTypeisRds,Redis,RAMCredentials,ECSorPolarDB. The value is a JSON string. For more information, see How to use it. - force_
delete_ boolwithout_ recovery - Specifies whether to immediately delete a secret. Default value:
false. Valid values:true,false. - policy str
- The content of the secret policy. The value is in the JSON format. The value can be up to 32,768 bytes in length. For more information, see How to use it.
- recovery_
window_ intin_ days - Specifies the recovery period of the secret if you do not forcibly delete it. Unit: Days. Default value:
30. Valid values:7to30. NOTE: IfforceDeleteWithoutRecoveryis set totrue,recoveryWindowInDayswill be ignored. - rotation_
interval str - The interval for automatic rotation. For more information, see How to use it.
- secret_
data_ strtype - The type of the secret value. Default value:
text. Valid values:text,binary. - secret_
type str - The type of the secret. Valid values:
Generic: Generic secret.Rds: ApsaraDB RDS secret.Redis: (Available since v1.253.0) ApsaraDB for Redis secret.RAMCredentials: RAM secret.ECS: ECS secret.PolarDB: (Available since v1.253.0) PolarDB secret.
- Mapping[str, str]
- A mapping of tags to assign to the resource.
- version_
stages Sequence[str] - The stage label that is used to mark the new version.
- secret
Data String - The data of the secret. NOTE: From version 1.204.1,
secretDataupdating diff will be ignored whensecretTypeis notGeneric. The expected format ofsecretDatadepends onsecretType:Generic: any custom string.Rds: a JSON string in the form{"Accounts":[{"AccountName":"<rds-account-name>","AccountPassword":"<rds-account-password>"}]}.RAMCredentials: a JSON string in the form{"AccessKeys":[{"AccessKeyId":"<access-key-id>","AccessKeySecret":"<access-key-secret>"}]}.ECS: a JSON string. Whenextended_config.SecretSubTypeisPassword, use{"UserName":"<user-name>","Password":"<password>"}. WhenSecretSubTypeisSSHKey, use{"UserName":"<user-name>","PublicKey":"<public-key>","PrivateKey":"<private-key>"}.RedisandPolarDB: use the literal string$Auto.
- secret
Name String - The name of the secret. For more information, see How to use it.
- version
Id String - The version number of the initial version.
- description String
- The description of the secret.
- dkms
Instance StringId - The ID of the KMS instance. NOTE: In KMS 3.0, this parameter is required.
- enable
Automatic BooleanRotation - Specifies whether to enable automatic rotation. Default value:
false. Valid values:true,false. - encryption
Key StringId - The ID of the KMS key used to encrypt the secret value. The key and the secret must belong to the same KMS instance, and the key must be a symmetric key. NOTE: In KMS 3.0, this parameter is required.
- extended
Config String - The extended configuration of the secret. This parameter is required when
secretTypeisRds,Redis,RAMCredentials,ECSorPolarDB. The value is a JSON string. For more information, see How to use it. - force
Delete BooleanWithout Recovery - Specifies whether to immediately delete a secret. Default value:
false. Valid values:true,false. - policy String
- The content of the secret policy. The value is in the JSON format. The value can be up to 32,768 bytes in length. For more information, see How to use it.
- recovery
Window NumberIn Days - Specifies the recovery period of the secret if you do not forcibly delete it. Unit: Days. Default value:
30. Valid values:7to30. NOTE: IfforceDeleteWithoutRecoveryis set totrue,recoveryWindowInDayswill be ignored. - rotation
Interval String - The interval for automatic rotation. For more information, see How to use it.
- secret
Data StringType - The type of the secret value. Default value:
text. Valid values:text,binary. - secret
Type String - The type of the secret. Valid values:
Generic: Generic secret.Rds: ApsaraDB RDS secret.Redis: (Available since v1.253.0) ApsaraDB for Redis secret.RAMCredentials: RAM secret.ECS: ECS secret.PolarDB: (Available since v1.253.0) PolarDB secret.
- Map<String>
- A mapping of tags to assign to the resource.
- version
Stages List<String> - The stage label that is used to mark the new version.
Outputs
All input properties are implicitly available as output properties. Additionally, the Secret resource produces the following output properties:
- Arn string
- The ARN of the secret.
- Create
Time string - (Available since v1.224.0) The time when the secret is created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Planned
Delete stringTime - The time when the secret is scheduled to be deleted.
- Arn string
- The ARN of the secret.
- Create
Time string - (Available since v1.224.0) The time when the secret is created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Planned
Delete stringTime - The time when the secret is scheduled to be deleted.
- arn string
- The ARN of the secret.
- create_
time string - (Available since v1.224.0) The time when the secret is created.
- id string
- The provider-assigned unique ID for this managed resource.
- planned_
delete_ stringtime - The time when the secret is scheduled to be deleted.
- arn String
- The ARN of the secret.
- create
Time String - (Available since v1.224.0) The time when the secret is created.
- id String
- The provider-assigned unique ID for this managed resource.
- planned
Delete StringTime - The time when the secret is scheduled to be deleted.
- arn string
- The ARN of the secret.
- create
Time string - (Available since v1.224.0) The time when the secret is created.
- id string
- The provider-assigned unique ID for this managed resource.
- planned
Delete stringTime - The time when the secret is scheduled to be deleted.
- arn str
- The ARN of the secret.
- create_
time str - (Available since v1.224.0) The time when the secret is created.
- id str
- The provider-assigned unique ID for this managed resource.
- planned_
delete_ strtime - The time when the secret is scheduled to be deleted.
- arn String
- The ARN of the secret.
- create
Time String - (Available since v1.224.0) The time when the secret is created.
- id String
- The provider-assigned unique ID for this managed resource.
- planned
Delete StringTime - The time when the secret is scheduled to be deleted.
Look up Existing Secret Resource
Get an existing Secret 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?: SecretState, opts?: CustomResourceOptions): Secret@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
arn: Optional[str] = None,
create_time: Optional[str] = None,
description: Optional[str] = None,
dkms_instance_id: Optional[str] = None,
enable_automatic_rotation: Optional[bool] = None,
encryption_key_id: Optional[str] = None,
extended_config: Optional[str] = None,
force_delete_without_recovery: Optional[bool] = None,
planned_delete_time: Optional[str] = None,
policy: Optional[str] = None,
recovery_window_in_days: Optional[int] = None,
rotation_interval: Optional[str] = None,
secret_data: Optional[str] = None,
secret_data_type: Optional[str] = None,
secret_name: Optional[str] = None,
secret_type: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
version_id: Optional[str] = None,
version_stages: Optional[Sequence[str]] = None) -> Secretfunc GetSecret(ctx *Context, name string, id IDInput, state *SecretState, opts ...ResourceOption) (*Secret, error)public static Secret Get(string name, Input<string> id, SecretState? state, CustomResourceOptions? opts = null)public static Secret get(String name, Output<String> id, SecretState state, CustomResourceOptions options)resources: _: type: alicloud:kms:Secret get: id: ${id}import {
to = alicloud_kms_secret.example
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.
- Arn string
- The ARN of the secret.
- Create
Time string - (Available since v1.224.0) The time when the secret is created.
- Description string
- The description of the secret.
- Dkms
Instance stringId - The ID of the KMS instance. NOTE: In KMS 3.0, this parameter is required.
- Enable
Automatic boolRotation - Specifies whether to enable automatic rotation. Default value:
false. Valid values:true,false. - Encryption
Key stringId - The ID of the KMS key used to encrypt the secret value. The key and the secret must belong to the same KMS instance, and the key must be a symmetric key. NOTE: In KMS 3.0, this parameter is required.
- Extended
Config string - The extended configuration of the secret. This parameter is required when
secretTypeisRds,Redis,RAMCredentials,ECSorPolarDB. The value is a JSON string. For more information, see How to use it. - Force
Delete boolWithout Recovery - Specifies whether to immediately delete a secret. Default value:
false. Valid values:true,false. - Planned
Delete stringTime - The time when the secret is scheduled to be deleted.
- Policy string
- The content of the secret policy. The value is in the JSON format. The value can be up to 32,768 bytes in length. For more information, see How to use it.
- Recovery
Window intIn Days - Specifies the recovery period of the secret if you do not forcibly delete it. Unit: Days. Default value:
30. Valid values:7to30. NOTE: IfforceDeleteWithoutRecoveryis set totrue,recoveryWindowInDayswill be ignored. - Rotation
Interval string - The interval for automatic rotation. For more information, see How to use it.
- Secret
Data string - The data of the secret. NOTE: From version 1.204.1,
secretDataupdating diff will be ignored whensecretTypeis notGeneric. The expected format ofsecretDatadepends onsecretType:Generic: any custom string.Rds: a JSON string in the form{"Accounts":[{"AccountName":"<rds-account-name>","AccountPassword":"<rds-account-password>"}]}.RAMCredentials: a JSON string in the form{"AccessKeys":[{"AccessKeyId":"<access-key-id>","AccessKeySecret":"<access-key-secret>"}]}.ECS: a JSON string. Whenextended_config.SecretSubTypeisPassword, use{"UserName":"<user-name>","Password":"<password>"}. WhenSecretSubTypeisSSHKey, use{"UserName":"<user-name>","PublicKey":"<public-key>","PrivateKey":"<private-key>"}.RedisandPolarDB: use the literal string$Auto.
- Secret
Data stringType - The type of the secret value. Default value:
text. Valid values:text,binary. - Secret
Name string - The name of the secret. For more information, see How to use it.
- Secret
Type string - The type of the secret. Valid values:
Generic: Generic secret.Rds: ApsaraDB RDS secret.Redis: (Available since v1.253.0) ApsaraDB for Redis secret.RAMCredentials: RAM secret.ECS: ECS secret.PolarDB: (Available since v1.253.0) PolarDB secret.
- Dictionary<string, string>
- A mapping of tags to assign to the resource.
- Version
Id string - The version number of the initial version.
- Version
Stages List<string> - The stage label that is used to mark the new version.
- Arn string
- The ARN of the secret.
- Create
Time string - (Available since v1.224.0) The time when the secret is created.
- Description string
- The description of the secret.
- Dkms
Instance stringId - The ID of the KMS instance. NOTE: In KMS 3.0, this parameter is required.
- Enable
Automatic boolRotation - Specifies whether to enable automatic rotation. Default value:
false. Valid values:true,false. - Encryption
Key stringId - The ID of the KMS key used to encrypt the secret value. The key and the secret must belong to the same KMS instance, and the key must be a symmetric key. NOTE: In KMS 3.0, this parameter is required.
- Extended
Config string - The extended configuration of the secret. This parameter is required when
secretTypeisRds,Redis,RAMCredentials,ECSorPolarDB. The value is a JSON string. For more information, see How to use it. - Force
Delete boolWithout Recovery - Specifies whether to immediately delete a secret. Default value:
false. Valid values:true,false. - Planned
Delete stringTime - The time when the secret is scheduled to be deleted.
- Policy string
- The content of the secret policy. The value is in the JSON format. The value can be up to 32,768 bytes in length. For more information, see How to use it.
- Recovery
Window intIn Days - Specifies the recovery period of the secret if you do not forcibly delete it. Unit: Days. Default value:
30. Valid values:7to30. NOTE: IfforceDeleteWithoutRecoveryis set totrue,recoveryWindowInDayswill be ignored. - Rotation
Interval string - The interval for automatic rotation. For more information, see How to use it.
- Secret
Data string - The data of the secret. NOTE: From version 1.204.1,
secretDataupdating diff will be ignored whensecretTypeis notGeneric. The expected format ofsecretDatadepends onsecretType:Generic: any custom string.Rds: a JSON string in the form{"Accounts":[{"AccountName":"<rds-account-name>","AccountPassword":"<rds-account-password>"}]}.RAMCredentials: a JSON string in the form{"AccessKeys":[{"AccessKeyId":"<access-key-id>","AccessKeySecret":"<access-key-secret>"}]}.ECS: a JSON string. Whenextended_config.SecretSubTypeisPassword, use{"UserName":"<user-name>","Password":"<password>"}. WhenSecretSubTypeisSSHKey, use{"UserName":"<user-name>","PublicKey":"<public-key>","PrivateKey":"<private-key>"}.RedisandPolarDB: use the literal string$Auto.
- Secret
Data stringType - The type of the secret value. Default value:
text. Valid values:text,binary. - Secret
Name string - The name of the secret. For more information, see How to use it.
- Secret
Type string - The type of the secret. Valid values:
Generic: Generic secret.Rds: ApsaraDB RDS secret.Redis: (Available since v1.253.0) ApsaraDB for Redis secret.RAMCredentials: RAM secret.ECS: ECS secret.PolarDB: (Available since v1.253.0) PolarDB secret.
- map[string]string
- A mapping of tags to assign to the resource.
- Version
Id string - The version number of the initial version.
- Version
Stages []string - The stage label that is used to mark the new version.
- arn string
- The ARN of the secret.
- create_
time string - (Available since v1.224.0) The time when the secret is created.
- description string
- The description of the secret.
- dkms_
instance_ stringid - The ID of the KMS instance. NOTE: In KMS 3.0, this parameter is required.
- enable_
automatic_ boolrotation - Specifies whether to enable automatic rotation. Default value:
false. Valid values:true,false. - encryption_
key_ stringid - The ID of the KMS key used to encrypt the secret value. The key and the secret must belong to the same KMS instance, and the key must be a symmetric key. NOTE: In KMS 3.0, this parameter is required.
- extended_
config string - The extended configuration of the secret. This parameter is required when
secretTypeisRds,Redis,RAMCredentials,ECSorPolarDB. The value is a JSON string. For more information, see How to use it. - force_
delete_ boolwithout_ recovery - Specifies whether to immediately delete a secret. Default value:
false. Valid values:true,false. - planned_
delete_ stringtime - The time when the secret is scheduled to be deleted.
- policy string
- The content of the secret policy. The value is in the JSON format. The value can be up to 32,768 bytes in length. For more information, see How to use it.
- recovery_
window_ numberin_ days - Specifies the recovery period of the secret if you do not forcibly delete it. Unit: Days. Default value:
30. Valid values:7to30. NOTE: IfforceDeleteWithoutRecoveryis set totrue,recoveryWindowInDayswill be ignored. - rotation_
interval string - The interval for automatic rotation. For more information, see How to use it.
- secret_
data string - The data of the secret. NOTE: From version 1.204.1,
secretDataupdating diff will be ignored whensecretTypeis notGeneric. The expected format ofsecretDatadepends onsecretType:Generic: any custom string.Rds: a JSON string in the form{"Accounts":[{"AccountName":"<rds-account-name>","AccountPassword":"<rds-account-password>"}]}.RAMCredentials: a JSON string in the form{"AccessKeys":[{"AccessKeyId":"<access-key-id>","AccessKeySecret":"<access-key-secret>"}]}.ECS: a JSON string. Whenextended_config.SecretSubTypeisPassword, use{"UserName":"<user-name>","Password":"<password>"}. WhenSecretSubTypeisSSHKey, use{"UserName":"<user-name>","PublicKey":"<public-key>","PrivateKey":"<private-key>"}.RedisandPolarDB: use the literal string$Auto.
- secret_
data_ stringtype - The type of the secret value. Default value:
text. Valid values:text,binary. - secret_
name string - The name of the secret. For more information, see How to use it.
- secret_
type string - The type of the secret. Valid values:
Generic: Generic secret.Rds: ApsaraDB RDS secret.Redis: (Available since v1.253.0) ApsaraDB for Redis secret.RAMCredentials: RAM secret.ECS: ECS secret.PolarDB: (Available since v1.253.0) PolarDB secret.
- map(string)
- A mapping of tags to assign to the resource.
- version_
id string - The version number of the initial version.
- version_
stages list(string) - The stage label that is used to mark the new version.
- arn String
- The ARN of the secret.
- create
Time String - (Available since v1.224.0) The time when the secret is created.
- description String
- The description of the secret.
- dkms
Instance StringId - The ID of the KMS instance. NOTE: In KMS 3.0, this parameter is required.
- enable
Automatic BooleanRotation - Specifies whether to enable automatic rotation. Default value:
false. Valid values:true,false. - encryption
Key StringId - The ID of the KMS key used to encrypt the secret value. The key and the secret must belong to the same KMS instance, and the key must be a symmetric key. NOTE: In KMS 3.0, this parameter is required.
- extended
Config String - The extended configuration of the secret. This parameter is required when
secretTypeisRds,Redis,RAMCredentials,ECSorPolarDB. The value is a JSON string. For more information, see How to use it. - force
Delete BooleanWithout Recovery - Specifies whether to immediately delete a secret. Default value:
false. Valid values:true,false. - planned
Delete StringTime - The time when the secret is scheduled to be deleted.
- policy String
- The content of the secret policy. The value is in the JSON format. The value can be up to 32,768 bytes in length. For more information, see How to use it.
- recovery
Window IntegerIn Days - Specifies the recovery period of the secret if you do not forcibly delete it. Unit: Days. Default value:
30. Valid values:7to30. NOTE: IfforceDeleteWithoutRecoveryis set totrue,recoveryWindowInDayswill be ignored. - rotation
Interval String - The interval for automatic rotation. For more information, see How to use it.
- secret
Data String - The data of the secret. NOTE: From version 1.204.1,
secretDataupdating diff will be ignored whensecretTypeis notGeneric. The expected format ofsecretDatadepends onsecretType:Generic: any custom string.Rds: a JSON string in the form{"Accounts":[{"AccountName":"<rds-account-name>","AccountPassword":"<rds-account-password>"}]}.RAMCredentials: a JSON string in the form{"AccessKeys":[{"AccessKeyId":"<access-key-id>","AccessKeySecret":"<access-key-secret>"}]}.ECS: a JSON string. Whenextended_config.SecretSubTypeisPassword, use{"UserName":"<user-name>","Password":"<password>"}. WhenSecretSubTypeisSSHKey, use{"UserName":"<user-name>","PublicKey":"<public-key>","PrivateKey":"<private-key>"}.RedisandPolarDB: use the literal string$Auto.
- secret
Data StringType - The type of the secret value. Default value:
text. Valid values:text,binary. - secret
Name String - The name of the secret. For more information, see How to use it.
- secret
Type String - The type of the secret. Valid values:
Generic: Generic secret.Rds: ApsaraDB RDS secret.Redis: (Available since v1.253.0) ApsaraDB for Redis secret.RAMCredentials: RAM secret.ECS: ECS secret.PolarDB: (Available since v1.253.0) PolarDB secret.
- Map<String,String>
- A mapping of tags to assign to the resource.
- version
Id String - The version number of the initial version.
- version
Stages List<String> - The stage label that is used to mark the new version.
- arn string
- The ARN of the secret.
- create
Time string - (Available since v1.224.0) The time when the secret is created.
- description string
- The description of the secret.
- dkms
Instance stringId - The ID of the KMS instance. NOTE: In KMS 3.0, this parameter is required.
- enable
Automatic booleanRotation - Specifies whether to enable automatic rotation. Default value:
false. Valid values:true,false. - encryption
Key stringId - The ID of the KMS key used to encrypt the secret value. The key and the secret must belong to the same KMS instance, and the key must be a symmetric key. NOTE: In KMS 3.0, this parameter is required.
- extended
Config string - The extended configuration of the secret. This parameter is required when
secretTypeisRds,Redis,RAMCredentials,ECSorPolarDB. The value is a JSON string. For more information, see How to use it. - force
Delete booleanWithout Recovery - Specifies whether to immediately delete a secret. Default value:
false. Valid values:true,false. - planned
Delete stringTime - The time when the secret is scheduled to be deleted.
- policy string
- The content of the secret policy. The value is in the JSON format. The value can be up to 32,768 bytes in length. For more information, see How to use it.
- recovery
Window numberIn Days - Specifies the recovery period of the secret if you do not forcibly delete it. Unit: Days. Default value:
30. Valid values:7to30. NOTE: IfforceDeleteWithoutRecoveryis set totrue,recoveryWindowInDayswill be ignored. - rotation
Interval string - The interval for automatic rotation. For more information, see How to use it.
- secret
Data string - The data of the secret. NOTE: From version 1.204.1,
secretDataupdating diff will be ignored whensecretTypeis notGeneric. The expected format ofsecretDatadepends onsecretType:Generic: any custom string.Rds: a JSON string in the form{"Accounts":[{"AccountName":"<rds-account-name>","AccountPassword":"<rds-account-password>"}]}.RAMCredentials: a JSON string in the form{"AccessKeys":[{"AccessKeyId":"<access-key-id>","AccessKeySecret":"<access-key-secret>"}]}.ECS: a JSON string. Whenextended_config.SecretSubTypeisPassword, use{"UserName":"<user-name>","Password":"<password>"}. WhenSecretSubTypeisSSHKey, use{"UserName":"<user-name>","PublicKey":"<public-key>","PrivateKey":"<private-key>"}.RedisandPolarDB: use the literal string$Auto.
- secret
Data stringType - The type of the secret value. Default value:
text. Valid values:text,binary. - secret
Name string - The name of the secret. For more information, see How to use it.
- secret
Type string - The type of the secret. Valid values:
Generic: Generic secret.Rds: ApsaraDB RDS secret.Redis: (Available since v1.253.0) ApsaraDB for Redis secret.RAMCredentials: RAM secret.ECS: ECS secret.PolarDB: (Available since v1.253.0) PolarDB secret.
- {[key: string]: string}
- A mapping of tags to assign to the resource.
- version
Id string - The version number of the initial version.
- version
Stages string[] - The stage label that is used to mark the new version.
- arn str
- The ARN of the secret.
- create_
time str - (Available since v1.224.0) The time when the secret is created.
- description str
- The description of the secret.
- dkms_
instance_ strid - The ID of the KMS instance. NOTE: In KMS 3.0, this parameter is required.
- enable_
automatic_ boolrotation - Specifies whether to enable automatic rotation. Default value:
false. Valid values:true,false. - encryption_
key_ strid - The ID of the KMS key used to encrypt the secret value. The key and the secret must belong to the same KMS instance, and the key must be a symmetric key. NOTE: In KMS 3.0, this parameter is required.
- extended_
config str - The extended configuration of the secret. This parameter is required when
secretTypeisRds,Redis,RAMCredentials,ECSorPolarDB. The value is a JSON string. For more information, see How to use it. - force_
delete_ boolwithout_ recovery - Specifies whether to immediately delete a secret. Default value:
false. Valid values:true,false. - planned_
delete_ strtime - The time when the secret is scheduled to be deleted.
- policy str
- The content of the secret policy. The value is in the JSON format. The value can be up to 32,768 bytes in length. For more information, see How to use it.
- recovery_
window_ intin_ days - Specifies the recovery period of the secret if you do not forcibly delete it. Unit: Days. Default value:
30. Valid values:7to30. NOTE: IfforceDeleteWithoutRecoveryis set totrue,recoveryWindowInDayswill be ignored. - rotation_
interval str - The interval for automatic rotation. For more information, see How to use it.
- secret_
data str - The data of the secret. NOTE: From version 1.204.1,
secretDataupdating diff will be ignored whensecretTypeis notGeneric. The expected format ofsecretDatadepends onsecretType:Generic: any custom string.Rds: a JSON string in the form{"Accounts":[{"AccountName":"<rds-account-name>","AccountPassword":"<rds-account-password>"}]}.RAMCredentials: a JSON string in the form{"AccessKeys":[{"AccessKeyId":"<access-key-id>","AccessKeySecret":"<access-key-secret>"}]}.ECS: a JSON string. Whenextended_config.SecretSubTypeisPassword, use{"UserName":"<user-name>","Password":"<password>"}. WhenSecretSubTypeisSSHKey, use{"UserName":"<user-name>","PublicKey":"<public-key>","PrivateKey":"<private-key>"}.RedisandPolarDB: use the literal string$Auto.
- secret_
data_ strtype - The type of the secret value. Default value:
text. Valid values:text,binary. - secret_
name str - The name of the secret. For more information, see How to use it.
- secret_
type str - The type of the secret. Valid values:
Generic: Generic secret.Rds: ApsaraDB RDS secret.Redis: (Available since v1.253.0) ApsaraDB for Redis secret.RAMCredentials: RAM secret.ECS: ECS secret.PolarDB: (Available since v1.253.0) PolarDB secret.
- Mapping[str, str]
- A mapping of tags to assign to the resource.
- version_
id str - The version number of the initial version.
- version_
stages Sequence[str] - The stage label that is used to mark the new version.
- arn String
- The ARN of the secret.
- create
Time String - (Available since v1.224.0) The time when the secret is created.
- description String
- The description of the secret.
- dkms
Instance StringId - The ID of the KMS instance. NOTE: In KMS 3.0, this parameter is required.
- enable
Automatic BooleanRotation - Specifies whether to enable automatic rotation. Default value:
false. Valid values:true,false. - encryption
Key StringId - The ID of the KMS key used to encrypt the secret value. The key and the secret must belong to the same KMS instance, and the key must be a symmetric key. NOTE: In KMS 3.0, this parameter is required.
- extended
Config String - The extended configuration of the secret. This parameter is required when
secretTypeisRds,Redis,RAMCredentials,ECSorPolarDB. The value is a JSON string. For more information, see How to use it. - force
Delete BooleanWithout Recovery - Specifies whether to immediately delete a secret. Default value:
false. Valid values:true,false. - planned
Delete StringTime - The time when the secret is scheduled to be deleted.
- policy String
- The content of the secret policy. The value is in the JSON format. The value can be up to 32,768 bytes in length. For more information, see How to use it.
- recovery
Window NumberIn Days - Specifies the recovery period of the secret if you do not forcibly delete it. Unit: Days. Default value:
30. Valid values:7to30. NOTE: IfforceDeleteWithoutRecoveryis set totrue,recoveryWindowInDayswill be ignored. - rotation
Interval String - The interval for automatic rotation. For more information, see How to use it.
- secret
Data String - The data of the secret. NOTE: From version 1.204.1,
secretDataupdating diff will be ignored whensecretTypeis notGeneric. The expected format ofsecretDatadepends onsecretType:Generic: any custom string.Rds: a JSON string in the form{"Accounts":[{"AccountName":"<rds-account-name>","AccountPassword":"<rds-account-password>"}]}.RAMCredentials: a JSON string in the form{"AccessKeys":[{"AccessKeyId":"<access-key-id>","AccessKeySecret":"<access-key-secret>"}]}.ECS: a JSON string. Whenextended_config.SecretSubTypeisPassword, use{"UserName":"<user-name>","Password":"<password>"}. WhenSecretSubTypeisSSHKey, use{"UserName":"<user-name>","PublicKey":"<public-key>","PrivateKey":"<private-key>"}.RedisandPolarDB: use the literal string$Auto.
- secret
Data StringType - The type of the secret value. Default value:
text. Valid values:text,binary. - secret
Name String - The name of the secret. For more information, see How to use it.
- secret
Type String - The type of the secret. Valid values:
Generic: Generic secret.Rds: ApsaraDB RDS secret.Redis: (Available since v1.253.0) ApsaraDB for Redis secret.RAMCredentials: RAM secret.ECS: ECS secret.PolarDB: (Available since v1.253.0) PolarDB secret.
- Map<String>
- A mapping of tags to assign to the resource.
- version
Id String - The version number of the initial version.
- version
Stages List<String> - The stage label that is used to mark the new version.
Import
KMS Secret can be imported using the id, e.g.
$ pulumi import alicloud:kms/secret:Secret example <id>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloudTerraform Provider.
published on Tuesday, Oct 27, 2026 by Pulumi