1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. kms
  5. Policy
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.kms.Policy

Explore with Pulumi AI

Provides a KMS Policy resource. Permission policies which can be bound to the Application Access Points.

For information about KMS Policy and how to use it, see What is Policy.

NOTE: Available since v1.210.0.

Create Policy Resource

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

Constructor syntax

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

@overload
def Policy(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           access_control_rules: Optional[str] = None,
           kms_instance_id: Optional[str] = None,
           permissions: Optional[Sequence[str]] = None,
           policy_name: Optional[str] = None,
           resources: Optional[Sequence[str]] = None,
           description: Optional[str] = None)
func NewPolicy(ctx *Context, name string, args PolicyArgs, opts ...ResourceOption) (*Policy, error)
public Policy(string name, PolicyArgs args, CustomResourceOptions? opts = null)
public Policy(String name, PolicyArgs args)
public Policy(String name, PolicyArgs args, CustomResourceOptions options)
type: alicloud:kms:Policy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. PolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. PolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. PolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. PolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. PolicyArgs
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 examplepolicyResourceResourceFromKmspolicy = new AliCloud.Kms.Policy("examplepolicyResourceResourceFromKmspolicy", new()
{
    AccessControlRules = "string",
    KmsInstanceId = "string",
    Permissions = new[]
    {
        "string",
    },
    PolicyName = "string",
    Resources = new[]
    {
        "string",
    },
    Description = "string",
});
Copy
example, err := kms.NewPolicy(ctx, "examplepolicyResourceResourceFromKmspolicy", &kms.PolicyArgs{
	AccessControlRules: pulumi.String("string"),
	KmsInstanceId:      pulumi.String("string"),
	Permissions: pulumi.StringArray{
		pulumi.String("string"),
	},
	PolicyName: pulumi.String("string"),
	Resources: pulumi.StringArray{
		pulumi.String("string"),
	},
	Description: pulumi.String("string"),
})
Copy
var examplepolicyResourceResourceFromKmspolicy = new Policy("examplepolicyResourceResourceFromKmspolicy", PolicyArgs.builder()
    .accessControlRules("string")
    .kmsInstanceId("string")
    .permissions("string")
    .policyName("string")
    .resources("string")
    .description("string")
    .build());
Copy
examplepolicy_resource_resource_from_kmspolicy = alicloud.kms.Policy("examplepolicyResourceResourceFromKmspolicy",
    access_control_rules="string",
    kms_instance_id="string",
    permissions=["string"],
    policy_name="string",
    resources=["string"],
    description="string")
Copy
const examplepolicyResourceResourceFromKmspolicy = new alicloud.kms.Policy("examplepolicyResourceResourceFromKmspolicy", {
    accessControlRules: "string",
    kmsInstanceId: "string",
    permissions: ["string"],
    policyName: "string",
    resources: ["string"],
    description: "string",
});
Copy
type: alicloud:kms:Policy
properties:
    accessControlRules: string
    description: string
    kmsInstanceId: string
    permissions:
        - string
    policyName: string
    resources:
        - string
Copy

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

AccessControlRules This property is required. string
Network Rules in JSON struct.
KmsInstanceId
This property is required.
Changes to this property will trigger replacement.
string
KMS instance .
Permissions This property is required. List<string>
Allowed permissions (RBAC)Optional values:"RbacPermission/Template/CryptoServiceKeyUser" and "RbacPermission/Template/CryptoServiceSecretUser".
PolicyName
This property is required.
Changes to this property will trigger replacement.
string
Policy Name.
Resources This property is required. List<string>
The resources that the permission policy allows to access.Use "key/${KeyId}" or "key/" to specify a key or all keys.Use "secret/${SecretName}" or "secret/" to specify a secret or all secrets.
Description string
Description.
AccessControlRules This property is required. string
Network Rules in JSON struct.
KmsInstanceId
This property is required.
Changes to this property will trigger replacement.
string
KMS instance .
Permissions This property is required. []string
Allowed permissions (RBAC)Optional values:"RbacPermission/Template/CryptoServiceKeyUser" and "RbacPermission/Template/CryptoServiceSecretUser".
PolicyName
This property is required.
Changes to this property will trigger replacement.
string
Policy Name.
Resources This property is required. []string
The resources that the permission policy allows to access.Use "key/${KeyId}" or "key/" to specify a key or all keys.Use "secret/${SecretName}" or "secret/" to specify a secret or all secrets.
Description string
Description.
accessControlRules This property is required. String
Network Rules in JSON struct.
kmsInstanceId
This property is required.
Changes to this property will trigger replacement.
String
KMS instance .
permissions This property is required. List<String>
Allowed permissions (RBAC)Optional values:"RbacPermission/Template/CryptoServiceKeyUser" and "RbacPermission/Template/CryptoServiceSecretUser".
policyName
This property is required.
Changes to this property will trigger replacement.
String
Policy Name.
resources This property is required. List<String>
The resources that the permission policy allows to access.Use "key/${KeyId}" or "key/" to specify a key or all keys.Use "secret/${SecretName}" or "secret/" to specify a secret or all secrets.
description String
Description.
accessControlRules This property is required. string
Network Rules in JSON struct.
kmsInstanceId
This property is required.
Changes to this property will trigger replacement.
string
KMS instance .
permissions This property is required. string[]
Allowed permissions (RBAC)Optional values:"RbacPermission/Template/CryptoServiceKeyUser" and "RbacPermission/Template/CryptoServiceSecretUser".
policyName
This property is required.
Changes to this property will trigger replacement.
string
Policy Name.
resources This property is required. string[]
The resources that the permission policy allows to access.Use "key/${KeyId}" or "key/" to specify a key or all keys.Use "secret/${SecretName}" or "secret/" to specify a secret or all secrets.
description string
Description.
access_control_rules This property is required. str
Network Rules in JSON struct.
kms_instance_id
This property is required.
Changes to this property will trigger replacement.
str
KMS instance .
permissions This property is required. Sequence[str]
Allowed permissions (RBAC)Optional values:"RbacPermission/Template/CryptoServiceKeyUser" and "RbacPermission/Template/CryptoServiceSecretUser".
policy_name
This property is required.
Changes to this property will trigger replacement.
str
Policy Name.
resources This property is required. Sequence[str]
The resources that the permission policy allows to access.Use "key/${KeyId}" or "key/" to specify a key or all keys.Use "secret/${SecretName}" or "secret/" to specify a secret or all secrets.
description str
Description.
accessControlRules This property is required. String
Network Rules in JSON struct.
kmsInstanceId
This property is required.
Changes to this property will trigger replacement.
String
KMS instance .
permissions This property is required. List<String>
Allowed permissions (RBAC)Optional values:"RbacPermission/Template/CryptoServiceKeyUser" and "RbacPermission/Template/CryptoServiceSecretUser".
policyName
This property is required.
Changes to this property will trigger replacement.
String
Policy Name.
resources This property is required. List<String>
The resources that the permission policy allows to access.Use "key/${KeyId}" or "key/" to specify a key or all keys.Use "secret/${SecretName}" or "secret/" to specify a secret or all secrets.
description String
Description.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing Policy Resource

Get an existing Policy 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?: PolicyState, opts?: CustomResourceOptions): Policy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        access_control_rules: Optional[str] = None,
        description: Optional[str] = None,
        kms_instance_id: Optional[str] = None,
        permissions: Optional[Sequence[str]] = None,
        policy_name: Optional[str] = None,
        resources: Optional[Sequence[str]] = None) -> Policy
func GetPolicy(ctx *Context, name string, id IDInput, state *PolicyState, opts ...ResourceOption) (*Policy, error)
public static Policy Get(string name, Input<string> id, PolicyState? state, CustomResourceOptions? opts = null)
public static Policy get(String name, Output<String> id, PolicyState state, CustomResourceOptions options)
resources:  _:    type: alicloud:kms:Policy    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AccessControlRules string
Network Rules in JSON struct.
Description string
Description.
KmsInstanceId Changes to this property will trigger replacement. string
KMS instance .
Permissions List<string>
Allowed permissions (RBAC)Optional values:"RbacPermission/Template/CryptoServiceKeyUser" and "RbacPermission/Template/CryptoServiceSecretUser".
PolicyName Changes to this property will trigger replacement. string
Policy Name.
Resources List<string>
The resources that the permission policy allows to access.Use "key/${KeyId}" or "key/" to specify a key or all keys.Use "secret/${SecretName}" or "secret/" to specify a secret or all secrets.
AccessControlRules string
Network Rules in JSON struct.
Description string
Description.
KmsInstanceId Changes to this property will trigger replacement. string
KMS instance .
Permissions []string
Allowed permissions (RBAC)Optional values:"RbacPermission/Template/CryptoServiceKeyUser" and "RbacPermission/Template/CryptoServiceSecretUser".
PolicyName Changes to this property will trigger replacement. string
Policy Name.
Resources []string
The resources that the permission policy allows to access.Use "key/${KeyId}" or "key/" to specify a key or all keys.Use "secret/${SecretName}" or "secret/" to specify a secret or all secrets.
accessControlRules String
Network Rules in JSON struct.
description String
Description.
kmsInstanceId Changes to this property will trigger replacement. String
KMS instance .
permissions List<String>
Allowed permissions (RBAC)Optional values:"RbacPermission/Template/CryptoServiceKeyUser" and "RbacPermission/Template/CryptoServiceSecretUser".
policyName Changes to this property will trigger replacement. String
Policy Name.
resources List<String>
The resources that the permission policy allows to access.Use "key/${KeyId}" or "key/" to specify a key or all keys.Use "secret/${SecretName}" or "secret/" to specify a secret or all secrets.
accessControlRules string
Network Rules in JSON struct.
description string
Description.
kmsInstanceId Changes to this property will trigger replacement. string
KMS instance .
permissions string[]
Allowed permissions (RBAC)Optional values:"RbacPermission/Template/CryptoServiceKeyUser" and "RbacPermission/Template/CryptoServiceSecretUser".
policyName Changes to this property will trigger replacement. string
Policy Name.
resources string[]
The resources that the permission policy allows to access.Use "key/${KeyId}" or "key/" to specify a key or all keys.Use "secret/${SecretName}" or "secret/" to specify a secret or all secrets.
access_control_rules str
Network Rules in JSON struct.
description str
Description.
kms_instance_id Changes to this property will trigger replacement. str
KMS instance .
permissions Sequence[str]
Allowed permissions (RBAC)Optional values:"RbacPermission/Template/CryptoServiceKeyUser" and "RbacPermission/Template/CryptoServiceSecretUser".
policy_name Changes to this property will trigger replacement. str
Policy Name.
resources Sequence[str]
The resources that the permission policy allows to access.Use "key/${KeyId}" or "key/" to specify a key or all keys.Use "secret/${SecretName}" or "secret/" to specify a secret or all secrets.
accessControlRules String
Network Rules in JSON struct.
description String
Description.
kmsInstanceId Changes to this property will trigger replacement. String
KMS instance .
permissions List<String>
Allowed permissions (RBAC)Optional values:"RbacPermission/Template/CryptoServiceKeyUser" and "RbacPermission/Template/CryptoServiceSecretUser".
policyName Changes to this property will trigger replacement. String
Policy Name.
resources List<String>
The resources that the permission policy allows to access.Use "key/${KeyId}" or "key/" to specify a key or all keys.Use "secret/${SecretName}" or "secret/" to specify a secret or all secrets.

Import

KMS Policy can be imported using the id, e.g.

$ pulumi import alicloud:kms/policy:Policy example <id>
Copy

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 alicloud Terraform Provider.