1. Packages
  2. Scaleway
  3. API Docs
  4. keymanager
  5. getKey
Scaleway v1.43.0 published on Friday, Feb 6, 2026 by pulumiverse
scaleway logo
Scaleway v1.43.0 published on Friday, Feb 6, 2026 by pulumiverse

    Gets information about a Key Manager Key. For more information, refer to the Key Manager API documentation.

    Example Usage

    Create a key and get its information

    The following commands allow you to:

    • create a key named my-kms-key
    • retrieve the key’s information using the key’s ID
    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumiverse/scaleway";
    
    // Create a key
    const symmetric = new scaleway.keymanager.Key("symmetric", {
        name: "my-kms-key",
        region: "fr-par",
        projectId: "your-project-id",
        usage: "symmetric_encryption",
        algorithm: "aes_256_gcm",
        description: "Key for encrypting secrets",
        tags: [
            "env:prod",
            "kms",
        ],
        unprotected: true,
        rotationPolicy: {
            rotationPeriod: "720h",
        },
    });
    // Get the key information by its ID
    const byID = scaleway.keymanager.getKey({
        keyId: "11111111-1111-1111-1111-111111111111",
    });
    
    import pulumi
    import pulumi_scaleway as scaleway
    import pulumiverse_scaleway as scaleway
    
    # Create a key
    symmetric = scaleway.keymanager.Key("symmetric",
        name="my-kms-key",
        region="fr-par",
        project_id="your-project-id",
        usage="symmetric_encryption",
        algorithm="aes_256_gcm",
        description="Key for encrypting secrets",
        tags=[
            "env:prod",
            "kms",
        ],
        unprotected=True,
        rotation_policy={
            "rotation_period": "720h",
        })
    # Get the key information by its ID
    by_id = scaleway.keymanager.get_key(key_id="11111111-1111-1111-1111-111111111111")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/keymanager"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Create a key
    		_, err := keymanager.NewKey(ctx, "symmetric", &keymanager.KeyArgs{
    			Name:        pulumi.String("my-kms-key"),
    			Region:      pulumi.String("fr-par"),
    			ProjectId:   pulumi.String("your-project-id"),
    			Usage:       pulumi.String("symmetric_encryption"),
    			Algorithm:   pulumi.String("aes_256_gcm"),
    			Description: pulumi.String("Key for encrypting secrets"),
    			Tags: pulumi.StringArray{
    				pulumi.String("env:prod"),
    				pulumi.String("kms"),
    			},
    			Unprotected: pulumi.Bool(true),
    			RotationPolicy: &keymanager.KeyRotationPolicyArgs{
    				RotationPeriod: pulumi.String("720h"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		// Get the key information by its ID
    		_, err = keymanager.LookupKey(ctx, &keymanager.LookupKeyArgs{
    			KeyId: "11111111-1111-1111-1111-111111111111",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Scaleway = Pulumi.Scaleway;
    using Scaleway = Pulumiverse.Scaleway;
    
    return await Deployment.RunAsync(() => 
    {
        // Create a key
        var symmetric = new Scaleway.Keymanager.Key("symmetric", new()
        {
            Name = "my-kms-key",
            Region = "fr-par",
            ProjectId = "your-project-id",
            Usage = "symmetric_encryption",
            Algorithm = "aes_256_gcm",
            Description = "Key for encrypting secrets",
            Tags = new[]
            {
                "env:prod",
                "kms",
            },
            Unprotected = true,
            RotationPolicy = new Scaleway.Keymanager.Inputs.KeyRotationPolicyArgs
            {
                RotationPeriod = "720h",
            },
        });
    
        // Get the key information by its ID
        var byID = Scaleway.Keymanager.GetKey.Invoke(new()
        {
            KeyId = "11111111-1111-1111-1111-111111111111",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.scaleway.keymanager.Key;
    import com.pulumi.scaleway.keymanager.KeyArgs;
    import com.pulumi.scaleway.keymanager.inputs.KeyRotationPolicyArgs;
    import com.pulumi.scaleway.keymanager.KeymanagerFunctions;
    import com.pulumi.scaleway.keymanager.inputs.GetKeyArgs;
    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) {
            // Create a key
            var symmetric = new Key("symmetric", KeyArgs.builder()
                .name("my-kms-key")
                .region("fr-par")
                .projectId("your-project-id")
                .usage("symmetric_encryption")
                .algorithm("aes_256_gcm")
                .description("Key for encrypting secrets")
                .tags(            
                    "env:prod",
                    "kms")
                .unprotected(true)
                .rotationPolicy(KeyRotationPolicyArgs.builder()
                    .rotationPeriod("720h")
                    .build())
                .build());
    
            // Get the key information by its ID
            final var byID = KeymanagerFunctions.getKey(GetKeyArgs.builder()
                .keyId("11111111-1111-1111-1111-111111111111")
                .build());
    
        }
    }
    
    resources:
      # Create a key
      symmetric:
        type: scaleway:keymanager:Key
        properties:
          name: my-kms-key
          region: fr-par
          projectId: your-project-id
          usage: symmetric_encryption
          algorithm: aes_256_gcm
          description: Key for encrypting secrets
          tags:
            - env:prod
            - kms
          unprotected: true
          rotationPolicy:
            rotationPeriod: 720h
    variables:
      # Get the key information by its ID
      byID:
        fn::invoke:
          function: scaleway:keymanager:getKey
          arguments:
            keyId: 11111111-1111-1111-1111-111111111111
    

    Using getKey

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getKey(args: GetKeyArgs, opts?: InvokeOptions): Promise<GetKeyResult>
    function getKeyOutput(args: GetKeyOutputArgs, opts?: InvokeOptions): Output<GetKeyResult>
    def get_key(key_id: Optional[str] = None,
                region: Optional[str] = None,
                opts: Optional[InvokeOptions] = None) -> GetKeyResult
    def get_key_output(key_id: Optional[pulumi.Input[str]] = None,
                region: Optional[pulumi.Input[str]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetKeyResult]
    func LookupKey(ctx *Context, args *LookupKeyArgs, opts ...InvokeOption) (*LookupKeyResult, error)
    func LookupKeyOutput(ctx *Context, args *LookupKeyOutputArgs, opts ...InvokeOption) LookupKeyResultOutput

    > Note: This function is named LookupKey in the Go SDK.

    public static class GetKey 
    {
        public static Task<GetKeyResult> InvokeAsync(GetKeyArgs args, InvokeOptions? opts = null)
        public static Output<GetKeyResult> Invoke(GetKeyInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetKeyResult> getKey(GetKeyArgs args, InvokeOptions options)
    public static Output<GetKeyResult> getKey(GetKeyArgs args, InvokeOptions options)
    
    fn::invoke:
      function: scaleway:keymanager/getKey:getKey
      arguments:
        # arguments dictionary

    The following arguments are supported:

    KeyId string
    ID of the key to target. Can be a plain UUID or a regional ID.
    Region string
    region) The region in which the key was created.
    KeyId string
    ID of the key to target. Can be a plain UUID or a regional ID.
    Region string
    region) The region in which the key was created.
    keyId String
    ID of the key to target. Can be a plain UUID or a regional ID.
    region String
    region) The region in which the key was created.
    keyId string
    ID of the key to target. Can be a plain UUID or a regional ID.
    region string
    region) The region in which the key was created.
    key_id str
    ID of the key to target. Can be a plain UUID or a regional ID.
    region str
    region) The region in which the key was created.
    keyId String
    ID of the key to target. Can be a plain UUID or a regional ID.
    region String
    region) The region in which the key was created.

    getKey Result

    The following output properties are available:

    Algorithm string
    CreatedAt string
    Description string
    Id string
    KeyId string
    Locked bool
    Name string
    Origin string
    ProjectId string
    Protected bool
    RotatedAt string
    RotationCount int
    RotationPolicies []GetKeyRotationPolicy
    State string
    Tags []string
    Unprotected bool
    UpdatedAt string
    Usage string
    Region string
    algorithm String
    createdAt String
    description String
    id String
    keyId String
    locked Boolean
    name String
    origin String
    projectId String
    protected_ Boolean
    rotatedAt String
    rotationCount Integer
    rotationPolicies List<GetKeyRotationPolicy>
    state String
    tags List<String>
    unprotected Boolean
    updatedAt String
    usage String
    region String
    algorithm string
    createdAt string
    description string
    id string
    keyId string
    locked boolean
    name string
    origin string
    projectId string
    protected boolean
    rotatedAt string
    rotationCount number
    rotationPolicies GetKeyRotationPolicy[]
    state string
    tags string[]
    unprotected boolean
    updatedAt string
    usage string
    region string
    algorithm String
    createdAt String
    description String
    id String
    keyId String
    locked Boolean
    name String
    origin String
    projectId String
    protected Boolean
    rotatedAt String
    rotationCount Number
    rotationPolicies List<Property Map>
    state String
    tags List<String>
    unprotected Boolean
    updatedAt String
    usage String
    region String

    Supporting Types

    GetKeyRotationPolicy

    NextRotationAt string
    Timestamp indicating the next scheduled rotation.
    RotationPeriod string
    Time interval between two key rotations. The minimum duration is 24 hours and the maximum duration is 1 year (876000 hours).
    NextRotationAt string
    Timestamp indicating the next scheduled rotation.
    RotationPeriod string
    Time interval between two key rotations. The minimum duration is 24 hours and the maximum duration is 1 year (876000 hours).
    nextRotationAt String
    Timestamp indicating the next scheduled rotation.
    rotationPeriod String
    Time interval between two key rotations. The minimum duration is 24 hours and the maximum duration is 1 year (876000 hours).
    nextRotationAt string
    Timestamp indicating the next scheduled rotation.
    rotationPeriod string
    Time interval between two key rotations. The minimum duration is 24 hours and the maximum duration is 1 year (876000 hours).
    next_rotation_at str
    Timestamp indicating the next scheduled rotation.
    rotation_period str
    Time interval between two key rotations. The minimum duration is 24 hours and the maximum duration is 1 year (876000 hours).
    nextRotationAt String
    Timestamp indicating the next scheduled rotation.
    rotationPeriod String
    Time interval between two key rotations. The minimum duration is 24 hours and the maximum duration is 1 year (876000 hours).

    Package Details

    Repository
    scaleway pulumiverse/pulumi-scaleway
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the scaleway Terraform Provider.
    scaleway logo
    Scaleway v1.43.0 published on Friday, Feb 6, 2026 by pulumiverse
      Meet Neo: Your AI Platform Teammate