Skip to main content
This example provisions a SQL Server Express Edition (sqlserver-ex) RDS instance joined to an AWS Managed Microsoft AD directory for Windows Authentication. It also demonstrates automated backup replication to a second region.

SQL Server edition identifiers

RDS SQL Server supports four engine identifiers. Choose the one that matches your license and workload requirements:
SQL Server Express Edition does not support encryption at rest. Set storage_encrypted = false when using sqlserver-ex. For production workloads requiring encryption, use sqlserver-ee or sqlserver-se.

Configuration

main.tf

MSSQL-specific configuration

Engine version format

SQL Server engine versions use the format "15.00" (SQL Server 2019), not a single integer. The corresponding family value follows the pattern "sqlserver-ex-15.0" and major_engine_version is "15.00".

License model

The license_model variable controls how you provide SQL Server licenses:

Timezone

The timezone variable sets the SQL Server instance timezone and can only be set at creation time. The value must be a valid Windows timezone identifier such as "GMT Standard Time", "Eastern Standard Time", or "UTC". Changing this after creation requires rebuilding the instance.

Character set

character_set_name = "Latin1_General_CI_AS" sets the SQL Server collation. CI means case-insensitive, AS means accent-sensitive. This is the default collation for most SQL Server installations. Like the timezone, the collation can only be set at creation time.

Parameter group

SQL Server Express Edition does not support custom DB parameter groups. The example sets create_db_parameter_group = false to skip parameter group creation.

Windows Authentication (Active Directory)

The example joins the RDS instance to an AWS Managed Microsoft AD directory using:
  • domain — the Directory Service directory ID
  • domain_iam_role_name — an IAM role with the AmazonRDSDirectoryServiceAccess managed policy attached
The security group includes an egress rule to the Directory Service security group, which is required for the RDS instance to communicate with the domain controllers. The aws_directory_service_directory resource provisions a Standard edition Managed AD at corp.demo.com.

CloudWatch log exports

For SQL Server, the error log type exports SQL Server error log entries. Other available log types include agent (SQL Server Agent) and trace.

Outputs