ReplicaExternalKey class

Manages a KMS multi-Region replica key that uses external key material. See the AWS KMS Developer Guide for more information on importing key material into multi-Region keys.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const primary = new aws.kms.ExternalKey("primary", {
    description: "Multi-Region primary key",
    deletionWindowInDays: 30,
    multiRegion: true,
    enabled: true,
    keyMaterialBase64: "...",
});
const replica = new aws.kms.ReplicaExternalKey("replica", {
    description: "Multi-Region replica key",
    deletionWindowInDays: 7,
    primaryKeyArn: primary.arn,
    keyMaterialBase64: "...",
});
import pulumi
import pulumi_aws as aws

primary = aws.kms.ExternalKey("primary",
    description="Multi-Region primary key",
    deletion_window_in_days=30,
    multi_region=True,
    enabled=True,
    key_material_base64="...")
replica = aws.kms.ReplicaExternalKey("replica",
    description="Multi-Region replica key",
    deletion_window_in_days=7,
    primary_key_arn=primary.arn,
    key_material_base64="...")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var primary = new Aws.Kms.ExternalKey("primary", new()
    {
        Description = "Multi-Region primary key",
        DeletionWindowInDays = 30,
        MultiRegion = true,
        Enabled = true,
        KeyMaterialBase64 = "...",
    });

    var replica = new Aws.Kms.ReplicaExternalKey("replica", new()
    {
        Description = "Multi-Region replica key",
        DeletionWindowInDays = 7,
        PrimaryKeyArn = primary.Arn,
        KeyMaterialBase64 = "...",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/kms"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		primary, err := kms.NewExternalKey(ctx, "primary", &kms.ExternalKeyArgs{
			Description:          pulumi.String("Multi-Region primary key"),
			DeletionWindowInDays: pulumi.Int(30),
			MultiRegion:          pulumi.Bool(true),
			Enabled:              pulumi.Bool(true),
			KeyMaterialBase64:    pulumi.String("..."),
		})
		if err != nil {
			return err
		}
		_, err = kms.NewReplicaExternalKey(ctx, "replica", &kms.ReplicaExternalKeyArgs{
			Description:          pulumi.String("Multi-Region replica key"),
			DeletionWindowInDays: pulumi.Int(7),
			PrimaryKeyArn:        primary.Arn,
			KeyMaterialBase64:    pulumi.String("..."),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_kms_externalkey" "primary" {
  description             = "Multi-Region primary key"
  deletion_window_in_days = 30
  multi_region            = true
  enabled                 = true
  key_material_base64     = "..."
}
resource "aws_kms_replicaexternalkey" "replica" {
  description             = "Multi-Region replica key"
  deletion_window_in_days = 7
  primary_key_arn         = aws_kms_externalkey.primary.arn
  key_material_base64     = "..."
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.kms.ExternalKey;
import com.pulumi.aws.kms.ExternalKeyArgs;
import com.pulumi.aws.kms.ReplicaExternalKey;
import com.pulumi.aws.kms.ReplicaExternalKeyArgs;
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) {
        var primary = new ExternalKey("primary", ExternalKeyArgs.builder()
            .description("Multi-Region primary key")
            .deletionWindowInDays(30)
            .multiRegion(true)
            .enabled(true)
            .keyMaterialBase64("...")
            .build());

        var replica = new ReplicaExternalKey("replica", ReplicaExternalKeyArgs.builder()
            .description("Multi-Region replica key")
            .deletionWindowInDays(7)
            .primaryKeyArn(primary.arn())
            .keyMaterialBase64("...")
            .build());

    }
}
resources:
  primary:
    type: aws:kms:ExternalKey
    properties:
      description: Multi-Region primary key
      deletionWindowInDays: 30
      multiRegion: true
      enabled: true
      keyMaterialBase64: '...'
  replica:
    type: aws:kms:ReplicaExternalKey
    properties:
      description: Multi-Region replica key
      deletionWindowInDays: 7
      primaryKeyArn: ${primary.arn}
      keyMaterialBase64: '...'

Import

Using pulumi import, import KMS multi-Region replica keys using the id. For example:

$ pulumi import aws:kms/replicaExternalKey:ReplicaExternalKey example 1234abcd-12ab-34cd-56ef-1234567890ab

Constructors

ReplicaExternalKey(String name, {ReplicaExternalKeyArgs? args, CustomResourceOptions? options})
Creates a new ReplicaExternalKey. name The Pulumi resource name. args Arguments used to configure this ReplicaExternalKey. The set of arguments for ReplicaExternalKey. options Resource options controlling this resource's behavior.
ReplicaExternalKey.reference(String urn)
Creates a typed reference to an existing ReplicaExternalKey resource.

Properties

arn ↔ Output<String>
ARN of the replica key. The key ARNs of related multi-Region keys differ only in the Region value.
latefinal
bypassPolicyLockoutSafetyCheck ↔ Output<bool?>
A flag to indicate whether to bypass the key policy lockout safety check. Setting this value to true increases the risk that the KMS key becomes unmanageable. Do not set this value to true indiscriminately. For more information, refer to the scenario in the Default Key Policy section in the AWS KMS Developer Guide. The default value is false.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
deletionWindowInDays ↔ Output<int?>
The waiting period, specified in number of days. After the waiting period ends, AWS KMS deletes the KMS key. If you specify a value, it must be between 7 and 30, inclusive. If you do not specify a value, it defaults to 30.
latefinal
description ↔ Output<String?>
A description of the KMS key.
latefinal
enabled ↔ Output<bool>
Specifies whether the replica key is enabled. Disabled KMS keys cannot be used in cryptographic operations. Keys pending import can only be false. Imported keys default to true unless expired.
latefinal
expirationModel ↔ Output<String>
Whether the key material expires. Empty when pending key material import, otherwise KEY_MATERIAL_EXPIRES or KEY_MATERIAL_DOES_NOT_EXPIRE.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
keyId ↔ Output<String>
The key ID of the replica key. Related multi-Region keys have the same key ID.
latefinal
keyMaterialBase64 ↔ Output<String?>
Base64 encoded 256-bit symmetric encryption key material to import. The KMS key is permanently associated with this key material. The same key material can be reimported, but you cannot import different key material.
latefinal
keyState ↔ Output<String>
The state of the replica key.
latefinal
keyUsage ↔ Output<String>
The cryptographic operations for which you can use the KMS key. This is a shared property of multi-Region keys.
latefinal
policy ↔ Output<String>
The key policy to attach to the KMS key. If you do not specify a key policy, AWS KMS attaches the default key policy to the KMS key.
latefinal
primaryKeyArn ↔ Output<String>
The ARN of the multi-Region primary key to replicate. The primary key must be in a different AWS Region of the same AWS Partition. You can create only one replica of a given primary key in each AWS Region.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tags ↔ Output<Map<String, String>?>
A map of tags to assign to the replica key. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited
validTo ↔ Output<String?>
Time at which the imported key material expires. When the key material expires, AWS KMS deletes the key material and the key becomes unusable. If not specified, key material does not expire. Valid values: RFC3339 time string (YYYY-MM-DDTHH:MM:SSZ)
latefinal

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {ReplicaExternalKeyState? state, CustomResourceOptions? options}) → ReplicaExternalKey
Gets an existing ReplicaExternalKey resource's state with the given name and id.