Skip to content

Commit

Permalink
test: Add tests for non default values for RDS (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
tony-griffin authored May 22, 2024
1 parent ca17b44 commit 7cc2dd3
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions postgres/tests/unit.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,61 @@ run "aws_db_instance_unit_test" {
# aws_db_instance.default.iops cannot be tested on a plan
}

run "aws_db_instance_unit_test_set_to_non_defaults" {
command = plan

variables {
config = {
version = 14,
deletion_protection = false,
multi_az = true,
skip_final_snapshot = true,
volume_size = 20,
iops = 3000,
instance = "db.t3.small",
storage_type = "io2"

}
}

# Test aws_db_instance.default resource version
assert {
condition = aws_db_instance.default.deletion_protection == false
error_message = "Should be: false"
}

assert {
condition = aws_db_instance.default.multi_az == true
error_message = "Should be: true"
}

assert {
condition = aws_db_instance.default.skip_final_snapshot == true
error_message = "Should be: true"
}

assert {
condition = aws_db_instance.default.allocated_storage == 20
error_message = "Should be: 20"
}

assert {
condition = aws_db_instance.default.iops == 3000
error_message = "Should be: 20"
}

assert {
condition = aws_db_instance.default.instance_class == "db.t3.small"
error_message = "Should be: db.t3.small"
}

assert {
condition = aws_db_instance.default.storage_type == "io2"
error_message = "Should be: io2"
}

}

run "aws_iam_role_unit_test" {
command = plan

Expand Down

0 comments on commit 7cc2dd3

Please sign in to comment.