This template sets up an RDS Aurora Cluster and configures a Database Activity Stream with encryption using AWS KMS.

Terraform Template

resource "aws_kms_key" "default" {
  description = "AWS KMS Key to encrypt Database Activity Stream"
}

resource "aws_rds_cluster" "default" {
  availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"]
  cluster_identifier = "aurora-cluster-demo"
  database_name = "mydb"
  engine = "aurora-postgresql"
  engine_version = "13.4"
  master_password = "mustbeeightcharaters"
  master_username = "foo"
}

resource "aws_rds_cluster_activity_stream" "default" {
  depends_on = ["aws_rds_cluster_instance.default"]
  kms_key_id = aws_kms_key.default.key_id
  mode = "async"
  resource_arn = aws_rds_cluster.default.arn
}

resource "aws_rds_cluster_instance" "default" {
  cluster_identifier = aws_rds_cluster.default.cluster_identifier
  engine = aws_rds_cluster.default.engine
  identifier = "aurora-instance-demo"
  instance_class = "db.r6g.large"
}