1. Packages
  2. Flexibleengine Provider
  3. API Docs
  4. KmsGrant
flexibleengine 1.46.0 published on Monday, Apr 14, 2025 by flexibleenginecloud

flexibleengine.KmsGrant

Explore with Pulumi AI

flexibleengine logo
flexibleengine 1.46.0 published on Monday, Apr 14, 2025 by flexibleenginecloud

    Users can create authorizations for other IAM users or accounts, granting them permission to use their own master key (CMK), and a maximum of 100 authorizations can be created under one master key.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as flexibleengine from "@pulumi/flexibleengine";
    
    const config = new pulumi.Config();
    const keyId = config.requireObject("keyId");
    const userId = config.requireObject("userId");
    const test = new flexibleengine.KmsGrant("test", {
        keyId: keyId,
        type: "user",
        granteePrincipal: userId,
        operations: [
            "create-datakey",
            "encrypt-datakey",
        ],
    });
    
    import pulumi
    import pulumi_flexibleengine as flexibleengine
    
    config = pulumi.Config()
    key_id = config.require_object("keyId")
    user_id = config.require_object("userId")
    test = flexibleengine.KmsGrant("test",
        key_id=key_id,
        type="user",
        grantee_principal=user_id,
        operations=[
            "create-datakey",
            "encrypt-datakey",
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/flexibleengine/flexibleengine"
    	"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, "")
    		keyId := cfg.RequireObject("keyId")
    		userId := cfg.RequireObject("userId")
    		_, err := flexibleengine.NewKmsGrant(ctx, "test", &flexibleengine.KmsGrantArgs{
    			KeyId:            pulumi.Any(keyId),
    			Type:             pulumi.String("user"),
    			GranteePrincipal: pulumi.Any(userId),
    			Operations: pulumi.StringArray{
    				pulumi.String("create-datakey"),
    				pulumi.String("encrypt-datakey"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Flexibleengine = Pulumi.Flexibleengine;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var keyId = config.RequireObject<dynamic>("keyId");
        var userId = config.RequireObject<dynamic>("userId");
        var test = new Flexibleengine.KmsGrant("test", new()
        {
            KeyId = keyId,
            Type = "user",
            GranteePrincipal = userId,
            Operations = new[]
            {
                "create-datakey",
                "encrypt-datakey",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.flexibleengine.KmsGrant;
    import com.pulumi.flexibleengine.KmsGrantArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var config = ctx.config();
            final var keyId = config.get("keyId");
            final var userId = config.get("userId");
            var test = new KmsGrant("test", KmsGrantArgs.builder()
                .keyId(keyId)
                .type("user")
                .granteePrincipal(userId)
                .operations(            
                    "create-datakey",
                    "encrypt-datakey")
                .build());
    
        }
    }
    
    configuration:
      keyId:
        type: dynamic
      userId:
        type: dynamic
    resources:
      test:
        type: flexibleengine:KmsGrant
        properties:
          keyId: ${keyId}
          type: user
          granteePrincipal: ${userId}
          operations:
            - create-datakey
            - encrypt-datakey
    

    Create KmsGrant Resource

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

    Constructor syntax

    new KmsGrant(name: string, args: KmsGrantArgs, opts?: CustomResourceOptions);
    @overload
    def KmsGrant(resource_name: str,
                 args: KmsGrantArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def KmsGrant(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 grantee_principal: Optional[str] = None,
                 key_id: Optional[str] = None,
                 operations: Optional[Sequence[str]] = None,
                 kms_grant_id: Optional[str] = None,
                 name: Optional[str] = None,
                 region: Optional[str] = None,
                 type: Optional[str] = None)
    func NewKmsGrant(ctx *Context, name string, args KmsGrantArgs, opts ...ResourceOption) (*KmsGrant, error)
    public KmsGrant(string name, KmsGrantArgs args, CustomResourceOptions? opts = null)
    public KmsGrant(String name, KmsGrantArgs args)
    public KmsGrant(String name, KmsGrantArgs args, CustomResourceOptions options)
    
    type: flexibleengine:KmsGrant
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args KmsGrantArgs
    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 KmsGrantArgs
    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 KmsGrantArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args KmsGrantArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args KmsGrantArgs
    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 kmsGrantResource = new Flexibleengine.KmsGrant("kmsGrantResource", new()
    {
        GranteePrincipal = "string",
        KeyId = "string",
        Operations = new[]
        {
            "string",
        },
        KmsGrantId = "string",
        Name = "string",
        Region = "string",
        Type = "string",
    });
    
    example, err := flexibleengine.NewKmsGrant(ctx, "kmsGrantResource", &flexibleengine.KmsGrantArgs{
    	GranteePrincipal: pulumi.String("string"),
    	KeyId:            pulumi.String("string"),
    	Operations: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	KmsGrantId: pulumi.String("string"),
    	Name:       pulumi.String("string"),
    	Region:     pulumi.String("string"),
    	Type:       pulumi.String("string"),
    })
    
    var kmsGrantResource = new KmsGrant("kmsGrantResource", KmsGrantArgs.builder()
        .granteePrincipal("string")
        .keyId("string")
        .operations("string")
        .kmsGrantId("string")
        .name("string")
        .region("string")
        .type("string")
        .build());
    
    kms_grant_resource = flexibleengine.KmsGrant("kmsGrantResource",
        grantee_principal="string",
        key_id="string",
        operations=["string"],
        kms_grant_id="string",
        name="string",
        region="string",
        type="string")
    
    const kmsGrantResource = new flexibleengine.KmsGrant("kmsGrantResource", {
        granteePrincipal: "string",
        keyId: "string",
        operations: ["string"],
        kmsGrantId: "string",
        name: "string",
        region: "string",
        type: "string",
    });
    
    type: flexibleengine:KmsGrant
    properties:
        granteePrincipal: string
        keyId: string
        kmsGrantId: string
        name: string
        operations:
            - string
        region: string
        type: string
    

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

    GranteePrincipal string

    The ID of the authorized user or account.

    Changing this parameter will create a new resource.

    KeyId string

    Key ID.

    Changing this parameter will create a new resource.

    Operations List<string>

    List of granted operations. The options are: create-datakey, create-datakey-without-plaintext, encrypt-datakey, decrypt-datakey, describe-key, create-grant, retire-grant, encrypt-data, decrypt-data A value containing only create-grant is invalid.

    Changing this parameter will create a new resource.

    KmsGrantId string
    The resource ID.
    Name string

    Grant name.
    It must be 1 to 255 characters long, start with a letter, and contain only letters (case-sensitive), digits, hyphens (-), underscores (_), and slash(/).

    Changing this parameter will create a new resource.

    Region string
    Specifies the region in which to create the resource. If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
    Type string

    Authorization type. The options are: user, domain. The default value is user.

    Changing this parameter will create a new resource.

    GranteePrincipal string

    The ID of the authorized user or account.

    Changing this parameter will create a new resource.

    KeyId string

    Key ID.

    Changing this parameter will create a new resource.

    Operations []string

    List of granted operations. The options are: create-datakey, create-datakey-without-plaintext, encrypt-datakey, decrypt-datakey, describe-key, create-grant, retire-grant, encrypt-data, decrypt-data A value containing only create-grant is invalid.

    Changing this parameter will create a new resource.

    KmsGrantId string
    The resource ID.
    Name string

    Grant name.
    It must be 1 to 255 characters long, start with a letter, and contain only letters (case-sensitive), digits, hyphens (-), underscores (_), and slash(/).

    Changing this parameter will create a new resource.

    Region string
    Specifies the region in which to create the resource. If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
    Type string

    Authorization type. The options are: user, domain. The default value is user.

    Changing this parameter will create a new resource.

    granteePrincipal String

    The ID of the authorized user or account.

    Changing this parameter will create a new resource.

    keyId String

    Key ID.

    Changing this parameter will create a new resource.

    operations List<String>

    List of granted operations. The options are: create-datakey, create-datakey-without-plaintext, encrypt-datakey, decrypt-datakey, describe-key, create-grant, retire-grant, encrypt-data, decrypt-data A value containing only create-grant is invalid.

    Changing this parameter will create a new resource.

    kmsGrantId String
    The resource ID.
    name String

    Grant name.
    It must be 1 to 255 characters long, start with a letter, and contain only letters (case-sensitive), digits, hyphens (-), underscores (_), and slash(/).

    Changing this parameter will create a new resource.

    region String
    Specifies the region in which to create the resource. If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
    type String

    Authorization type. The options are: user, domain. The default value is user.

    Changing this parameter will create a new resource.

    granteePrincipal string

    The ID of the authorized user or account.

    Changing this parameter will create a new resource.

    keyId string

    Key ID.

    Changing this parameter will create a new resource.

    operations string[]

    List of granted operations. The options are: create-datakey, create-datakey-without-plaintext, encrypt-datakey, decrypt-datakey, describe-key, create-grant, retire-grant, encrypt-data, decrypt-data A value containing only create-grant is invalid.

    Changing this parameter will create a new resource.

    kmsGrantId string
    The resource ID.
    name string

    Grant name.
    It must be 1 to 255 characters long, start with a letter, and contain only letters (case-sensitive), digits, hyphens (-), underscores (_), and slash(/).

    Changing this parameter will create a new resource.

    region string
    Specifies the region in which to create the resource. If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
    type string

    Authorization type. The options are: user, domain. The default value is user.

    Changing this parameter will create a new resource.

    grantee_principal str

    The ID of the authorized user or account.

    Changing this parameter will create a new resource.

    key_id str

    Key ID.

    Changing this parameter will create a new resource.

    operations Sequence[str]

    List of granted operations. The options are: create-datakey, create-datakey-without-plaintext, encrypt-datakey, decrypt-datakey, describe-key, create-grant, retire-grant, encrypt-data, decrypt-data A value containing only create-grant is invalid.

    Changing this parameter will create a new resource.

    kms_grant_id str
    The resource ID.
    name str

    Grant name.
    It must be 1 to 255 characters long, start with a letter, and contain only letters (case-sensitive), digits, hyphens (-), underscores (_), and slash(/).

    Changing this parameter will create a new resource.

    region str
    Specifies the region in which to create the resource. If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
    type str

    Authorization type. The options are: user, domain. The default value is user.

    Changing this parameter will create a new resource.

    granteePrincipal String

    The ID of the authorized user or account.

    Changing this parameter will create a new resource.

    keyId String

    Key ID.

    Changing this parameter will create a new resource.

    operations List<String>

    List of granted operations. The options are: create-datakey, create-datakey-without-plaintext, encrypt-datakey, decrypt-datakey, describe-key, create-grant, retire-grant, encrypt-data, decrypt-data A value containing only create-grant is invalid.

    Changing this parameter will create a new resource.

    kmsGrantId String
    The resource ID.
    name String

    Grant name.
    It must be 1 to 255 characters long, start with a letter, and contain only letters (case-sensitive), digits, hyphens (-), underscores (_), and slash(/).

    Changing this parameter will create a new resource.

    region String
    Specifies the region in which to create the resource. If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
    type String

    Authorization type. The options are: user, domain. The default value is user.

    Changing this parameter will create a new resource.

    Outputs

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

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

    Look up Existing KmsGrant Resource

    Get an existing KmsGrant 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?: KmsGrantState, opts?: CustomResourceOptions): KmsGrant
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            creator: Optional[str] = None,
            grantee_principal: Optional[str] = None,
            key_id: Optional[str] = None,
            kms_grant_id: Optional[str] = None,
            name: Optional[str] = None,
            operations: Optional[Sequence[str]] = None,
            region: Optional[str] = None,
            type: Optional[str] = None) -> KmsGrant
    func GetKmsGrant(ctx *Context, name string, id IDInput, state *KmsGrantState, opts ...ResourceOption) (*KmsGrant, error)
    public static KmsGrant Get(string name, Input<string> id, KmsGrantState? state, CustomResourceOptions? opts = null)
    public static KmsGrant get(String name, Output<String> id, KmsGrantState state, CustomResourceOptions options)
    resources:  _:    type: flexibleengine:KmsGrant    get:      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.
    The following state arguments are supported:
    Creator string
    The ID of the creator.
    GranteePrincipal string

    The ID of the authorized user or account.

    Changing this parameter will create a new resource.

    KeyId string

    Key ID.

    Changing this parameter will create a new resource.

    KmsGrantId string
    The resource ID.
    Name string

    Grant name.
    It must be 1 to 255 characters long, start with a letter, and contain only letters (case-sensitive), digits, hyphens (-), underscores (_), and slash(/).

    Changing this parameter will create a new resource.

    Operations List<string>

    List of granted operations. The options are: create-datakey, create-datakey-without-plaintext, encrypt-datakey, decrypt-datakey, describe-key, create-grant, retire-grant, encrypt-data, decrypt-data A value containing only create-grant is invalid.

    Changing this parameter will create a new resource.

    Region string
    Specifies the region in which to create the resource. If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
    Type string

    Authorization type. The options are: user, domain. The default value is user.

    Changing this parameter will create a new resource.

    Creator string
    The ID of the creator.
    GranteePrincipal string

    The ID of the authorized user or account.

    Changing this parameter will create a new resource.

    KeyId string

    Key ID.

    Changing this parameter will create a new resource.

    KmsGrantId string
    The resource ID.
    Name string

    Grant name.
    It must be 1 to 255 characters long, start with a letter, and contain only letters (case-sensitive), digits, hyphens (-), underscores (_), and slash(/).

    Changing this parameter will create a new resource.

    Operations []string

    List of granted operations. The options are: create-datakey, create-datakey-without-plaintext, encrypt-datakey, decrypt-datakey, describe-key, create-grant, retire-grant, encrypt-data, decrypt-data A value containing only create-grant is invalid.

    Changing this parameter will create a new resource.

    Region string
    Specifies the region in which to create the resource. If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
    Type string

    Authorization type. The options are: user, domain. The default value is user.

    Changing this parameter will create a new resource.

    creator String
    The ID of the creator.
    granteePrincipal String

    The ID of the authorized user or account.

    Changing this parameter will create a new resource.

    keyId String

    Key ID.

    Changing this parameter will create a new resource.

    kmsGrantId String
    The resource ID.
    name String

    Grant name.
    It must be 1 to 255 characters long, start with a letter, and contain only letters (case-sensitive), digits, hyphens (-), underscores (_), and slash(/).

    Changing this parameter will create a new resource.

    operations List<String>

    List of granted operations. The options are: create-datakey, create-datakey-without-plaintext, encrypt-datakey, decrypt-datakey, describe-key, create-grant, retire-grant, encrypt-data, decrypt-data A value containing only create-grant is invalid.

    Changing this parameter will create a new resource.

    region String
    Specifies the region in which to create the resource. If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
    type String

    Authorization type. The options are: user, domain. The default value is user.

    Changing this parameter will create a new resource.

    creator string
    The ID of the creator.
    granteePrincipal string

    The ID of the authorized user or account.

    Changing this parameter will create a new resource.

    keyId string

    Key ID.

    Changing this parameter will create a new resource.

    kmsGrantId string
    The resource ID.
    name string

    Grant name.
    It must be 1 to 255 characters long, start with a letter, and contain only letters (case-sensitive), digits, hyphens (-), underscores (_), and slash(/).

    Changing this parameter will create a new resource.

    operations string[]

    List of granted operations. The options are: create-datakey, create-datakey-without-plaintext, encrypt-datakey, decrypt-datakey, describe-key, create-grant, retire-grant, encrypt-data, decrypt-data A value containing only create-grant is invalid.

    Changing this parameter will create a new resource.

    region string
    Specifies the region in which to create the resource. If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
    type string

    Authorization type. The options are: user, domain. The default value is user.

    Changing this parameter will create a new resource.

    creator str
    The ID of the creator.
    grantee_principal str

    The ID of the authorized user or account.

    Changing this parameter will create a new resource.

    key_id str

    Key ID.

    Changing this parameter will create a new resource.

    kms_grant_id str
    The resource ID.
    name str

    Grant name.
    It must be 1 to 255 characters long, start with a letter, and contain only letters (case-sensitive), digits, hyphens (-), underscores (_), and slash(/).

    Changing this parameter will create a new resource.

    operations Sequence[str]

    List of granted operations. The options are: create-datakey, create-datakey-without-plaintext, encrypt-datakey, decrypt-datakey, describe-key, create-grant, retire-grant, encrypt-data, decrypt-data A value containing only create-grant is invalid.

    Changing this parameter will create a new resource.

    region str
    Specifies the region in which to create the resource. If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
    type str

    Authorization type. The options are: user, domain. The default value is user.

    Changing this parameter will create a new resource.

    creator String
    The ID of the creator.
    granteePrincipal String

    The ID of the authorized user or account.

    Changing this parameter will create a new resource.

    keyId String

    Key ID.

    Changing this parameter will create a new resource.

    kmsGrantId String
    The resource ID.
    name String

    Grant name.
    It must be 1 to 255 characters long, start with a letter, and contain only letters (case-sensitive), digits, hyphens (-), underscores (_), and slash(/).

    Changing this parameter will create a new resource.

    operations List<String>

    List of granted operations. The options are: create-datakey, create-datakey-without-plaintext, encrypt-datakey, decrypt-datakey, describe-key, create-grant, retire-grant, encrypt-data, decrypt-data A value containing only create-grant is invalid.

    Changing this parameter will create a new resource.

    region String
    Specifies the region in which to create the resource. If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
    type String

    Authorization type. The options are: user, domain. The default value is user.

    Changing this parameter will create a new resource.

    Import

    The kms grant can be imported using

    key_id, grant_id, separated by slashes, e.g.

    bash

    $ pulumi import flexibleengine:index/kmsGrant:KmsGrant test <key_id>/<grant_id>
    

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

    Package Details

    Repository
    flexibleengine flexibleenginecloud/terraform-provider-flexibleengine
    License
    Notes
    This Pulumi package is based on the flexibleengine Terraform Provider.
    flexibleengine logo
    flexibleengine 1.46.0 published on Monday, Apr 14, 2025 by flexibleenginecloud