CodexBloom - Programming Q&A Platform

Terraform how to to configure AWS RDS instance with encrypted storage - 'InvalidParameterCombination'

👀 Views: 179 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-06
terraform aws rds hcl

I'm relatively new to this, so bear with me. I've been researching this but I'm not sure how to approach I'm working on a project and hit a roadblock. I'm working on automating the provisioning of an AWS RDS instance using Terraform, but I've encountered an scenario when trying to enable storage encryption. I'm using Terraform version 1.1.5 and the AWS provider version 3.45.0. When I apply my configuration, I receive the following behavior: `InvalidParameterCombination: The storage type must be GP2 or GP3 if storage encryption is enabled.` I've defined my RDS instance in the following way: ```hcl resource "aws_db_instance" "my_database" { allocated_storage = 20 engine = "mysql" engine_version = "8.0.23" instance_class = "db.t3.micro" storage_type = "gp2" db_identifier = "mydb-instance" username = "admin" password = "mypassword" db_name = "mydb" skip_final_snapshot = true storage_encrypted = true } ``` I initially thought this was related to the `storage_type`, so I tried changing it to `gp3`, but I got the same behavior. After reviewing the [AWS documentation](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.Encryption.html) regarding RDS encryption, it seems like my configuration should be valid. I also verified that my AWS account supports storage encryption for RDS instances. What am I missing here? Is there a specific requirement for the combination of `engine` and `storage_type` that I might be overlooking? Any help would be greatly appreciated! Any help would be greatly appreciated! I'm coming from a different tech stack and learning Hcl. Is there a better approach? The project is a web app built with Hcl. Any pointers in the right direction? Thanks for taking the time to read this!