# main.tf — DAT compliance fixture # Produces zero DAT policy violations terraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 5.0" } } } provider "aws" { region = "ap-south-1" } # DAT-001 + DAT-002 + DAT-003 + DAT-004 + DAT-005 resource "aws_db_instance" "good_rds" { identifier = "good-rds" engine = "mysql" engine_version = "8.0" instance_class = "db.t3.micro" allocated_storage = 20 username = "admin" password = "Goodpassword123" publicly_accessible = false storage_encrypted = true kms_key_id = "arn:aws:kms:ap-south-1:123456789012:key/mrk-1234abcd" deletion_protection = true auto_minor_version_upgrade = true skip_final_snapshot = false final_snapshot_identifier = "good-rds-final" enabled_cloudwatch_logs_exports = ["audit", "error", "general", "slowquery"] } # DAT-006 — DynamoDB with PITR enabled resource "aws_dynamodb_table" "good_table" { name = "good-table" billing_mode = "PAY_PER_REQUEST" hash_key = "id" attribute { name = "id" type = "S" } point_in_time_recovery { enabled = true } } # DAT-007 + DAT-008 — Redshift private, with logging resource "aws_redshift_cluster" "good_redshift" { cluster_identifier = "good-redshift" database_name = "gooddb" master_username = "admin" master_password = "Goodpassword123" node_type = "dc2.large" cluster_type = "single-node" publicly_accessible = false skip_final_snapshot = true } resource "aws_redshift_logging" "good_redshift_logging" { cluster_identifier = aws_redshift_cluster.good_redshift.cluster_identifier log_destination_type = "s3" bucket_name = "good-redshift-logs" s3_key_prefix = "redshift/" } # DAT-009 — ElastiCache with encryption resource "aws_elasticache_replication_group" "good_redis" { replication_group_id = "good-redis" description = "good redis" node_type = "cache.t3.micro" num_cache_clusters = 1 transit_encryption_enabled = true at_rest_encryption_enabled = true kms_key_id = "arn:aws:kms:ap-south-1:123456789012:key/mrk-1234abcd" }