This template creates a MACSec key association using a Direct Connect connection and references an existing Secrets Manager secret.

Terraform Template

data "aws_dx_connection" "example" {
  name = "tf-dx-connection"
}

data "aws_secretsmanager_secret" "example" {
  name = "directconnect!prod/us-east-1/directconnect/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
}

resource "aws_dx_macsec_key_association" "test" {
  connection_id = data.aws_dx_connection.example.id
  secret_arn = data.aws_secretsmanager_secret.example.arn
}