MacsecKeyAssociation class
Provides a MAC Security (MACSec) secret key resource for use with Direct Connect. See MACsec prerequisites for information about MAC Security (MACsec) prerequisites.
Creating this resource will also create a resource of type aws.secretsmanager.Secret which is managed by Direct Connect. While you can import this resource into your state, because this secret is managed by Direct Connect, you will not be able to make any modifications to it. See How AWS Direct Connect uses AWS Secrets Manager for details.
> Note: All arguments including ckn and cak will be stored in the raw state as plain-text.
> Note: The secretArn argument can only be used to reference a previously created MACSec key. You cannot associate a Secrets Manager secret created outside of the aws.directconnect.MacsecKeyAssociation resource.
Example Usage
Create MACSec key with CKN and CAK
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.directconnect.getConnection({
name: "tf-dx-connection",
});
const test = new aws.directconnect.MacsecKeyAssociation("test", {
connectionId: example.then(example => example.id),
ckn: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
cak: "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789",
});
import pulumi
import pulumi_aws as aws
example = aws.directconnect.get_connection(name="tf-dx-connection")
test = aws.directconnect.MacsecKeyAssociation("test",
connection_id=example.id,
ckn="0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
cak="abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = Aws.DirectConnect.GetConnection.Invoke(new()
{
Name = "tf-dx-connection",
});
var test = new Aws.DirectConnect.MacsecKeyAssociation("test", new()
{
ConnectionId = example.Apply(getConnectionResult => getConnectionResult.Id),
Ckn = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
Cak = "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/directconnect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := directconnect.LookupConnection(ctx, &directconnect.LookupConnectionArgs{
Name: "tf-dx-connection",
}, nil)
if err != nil {
return err
}
_, err = directconnect.NewMacsecKeyAssociation(ctx, "test", &directconnect.MacsecKeyAssociationArgs{
ConnectionId: pulumi.String(example.Id),
Ckn: pulumi.String("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"),
Cak: pulumi.String("abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
data "aws_directconnect_getconnection" "example" {
name = "tf-dx-connection"
}
resource "aws_directconnect_macseckeyassociation" "test" {
connection_id = data.aws_directconnect_getconnection.example.id
ckn = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
cak = "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.directconnect.DirectconnectFunctions;
import com.pulumi.aws.directconnect.inputs.GetConnectionArgs;
import com.pulumi.aws.directconnect.MacsecKeyAssociation;
import com.pulumi.aws.directconnect.MacsecKeyAssociationArgs;
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 example = DirectconnectFunctions.getConnection(GetConnectionArgs.builder()
.name("tf-dx-connection")
.build());
var test = new MacsecKeyAssociation("test", MacsecKeyAssociationArgs.builder()
.connectionId(example.id())
.ckn("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")
.cak("abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789")
.build());
}
}
resources:
test:
type: aws:directconnect:MacsecKeyAssociation
properties:
connectionId: ${example.id}
ckn: 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
cak: abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789
variables:
example:
fn::invoke:
function: aws:directconnect:getConnection
arguments:
name: tf-dx-connection
Create MACSec key with existing Secrets Manager secret
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.directconnect.getConnection({
name: "tf-dx-connection",
});
const exampleGetSecret = aws.secretsmanager.getSecret({
name: "directconnect!prod/us-east-1/directconnect/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
});
const test = new aws.directconnect.MacsecKeyAssociation("test", {
connectionId: example.then(example => example.id),
secretArn: exampleGetSecret.then(exampleGetSecret => exampleGetSecret.arn),
});
import pulumi
import pulumi_aws as aws
example = aws.directconnect.get_connection(name="tf-dx-connection")
example_get_secret = aws.secretsmanager.get_secret(name="directconnect!prod/us-east-1/directconnect/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")
test = aws.directconnect.MacsecKeyAssociation("test",
connection_id=example.id,
secret_arn=example_get_secret.arn)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = Aws.DirectConnect.GetConnection.Invoke(new()
{
Name = "tf-dx-connection",
});
var exampleGetSecret = Aws.SecretsManager.GetSecret.Invoke(new()
{
Name = "directconnect!prod/us-east-1/directconnect/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
});
var test = new Aws.DirectConnect.MacsecKeyAssociation("test", new()
{
ConnectionId = example.Apply(getConnectionResult => getConnectionResult.Id),
SecretArn = exampleGetSecret.Apply(getSecretResult => getSecretResult.Arn),
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/directconnect"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/secretsmanager"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := directconnect.LookupConnection(ctx, &directconnect.LookupConnectionArgs{
Name: "tf-dx-connection",
}, nil)
if err != nil {
return err
}
exampleGetSecret, err := secretsmanager.LookupSecret(ctx, &secretsmanager.LookupSecretArgs{
Name: pulumi.StringRef("directconnect!prod/us-east-1/directconnect/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"),
}, nil)
if err != nil {
return err
}
_, err = directconnect.NewMacsecKeyAssociation(ctx, "test", &directconnect.MacsecKeyAssociationArgs{
ConnectionId: pulumi.String(example.Id),
SecretArn: pulumi.String(exampleGetSecret.Arn),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
data "aws_directconnect_getconnection" "example" {
name = "tf-dx-connection"
}
data "aws_secretsmanager_getsecret" "exampleGetSecret" {
name = "directconnect!prod/us-east-1/directconnect/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
}
resource "aws_directconnect_macseckeyassociation" "test" {
connection_id = data.aws_directconnect_getconnection.example.id
secret_arn = data.aws_secretsmanager_getsecret.exampleGetSecret.arn
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.directconnect.DirectconnectFunctions;
import com.pulumi.aws.directconnect.inputs.GetConnectionArgs;
import com.pulumi.aws.secretsmanager.SecretsmanagerFunctions;
import com.pulumi.aws.secretsmanager.inputs.GetSecretArgs;
import com.pulumi.aws.directconnect.MacsecKeyAssociation;
import com.pulumi.aws.directconnect.MacsecKeyAssociationArgs;
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 example = DirectconnectFunctions.getConnection(GetConnectionArgs.builder()
.name("tf-dx-connection")
.build());
final var exampleGetSecret = SecretsmanagerFunctions.getSecret(GetSecretArgs.builder()
.name("directconnect!prod/us-east-1/directconnect/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")
.build());
var test = new MacsecKeyAssociation("test", MacsecKeyAssociationArgs.builder()
.connectionId(example.id())
.secretArn(exampleGetSecret.arn())
.build());
}
}
resources:
test:
type: aws:directconnect:MacsecKeyAssociation
properties:
connectionId: ${example.id}
secretArn: ${exampleGetSecret.arn}
variables:
example:
fn::invoke:
function: aws:directconnect:getConnection
arguments:
name: tf-dx-connection
exampleGetSecret:
fn::invoke:
function: aws:secretsmanager:getSecret
arguments:
name: directconnect!prod/us-east-1/directconnect/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
Constructors
- MacsecKeyAssociation(String name, {MacsecKeyAssociationArgs? args, CustomResourceOptions? options})
-
Creates a new MacsecKeyAssociation.
nameThe Pulumi resource name.argsArguments used to configure this MacsecKeyAssociation. The set of arguments for MacsecKeyAssociation.optionsResource options controlling this resource's behavior. - MacsecKeyAssociation.reference(String urn)
- Creates a typed reference to an existing MacsecKeyAssociation resource.
Properties
-
cak
↔ Output<
String?> -
The MAC Security (MACsec) CAK to associate with the dedicated connection. The valid values are 64 hexadecimal characters (0-9, A-E). Required if using
ckn.latefinal -
childResources
→ Set<
Resource> -
finalinherited
-
ckn
↔ Output<
String> -
The MAC Security (MACsec) CKN to associate with the dedicated connection. The valid values are 64 hexadecimal characters (0-9, A-E). Required if using
cak.latefinal -
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
connectionId
↔ Output<
String> -
The ID of the dedicated Direct Connect connection. The connection must be a dedicated connection in the
AVAILABLEstate.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
-
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
-
secretArn
↔ Output<
String> -
ARN of the MAC Security (MACsec) secret key to associate with the dedicated connection.
latefinal
-
startOn
↔ Output<
String> -
The date in UTC format that the MAC Security (MACsec) secret key takes effect.
latefinal
-
state
↔ Output<
String> -
The state of the MAC Security (MACsec) secret key. The possible values are: associating, associated, disassociating, disassociated. See MacSecKey for descriptions of each state.
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
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, {MacsecKeyAssociationState? state, CustomResourceOptions? options}) → MacsecKeyAssociation -
Gets an existing MacsecKeyAssociation resource's state with the given
nameandid.