Changing the db_instance resource to mark the engine_version as Optional

This commit is contained in:
stack72 2015-11-03 23:57:51 +00:00
parent 0d69159fc5
commit 1abb0b19bf
3 changed files with 43 additions and 2 deletions

View File

@ -54,7 +54,7 @@ func resourceAwsDbInstance() *schema.Resource {
"engine_version": &schema.Schema{
Type: schema.TypeString,
Required: true,
Optional: true,
},
"storage_encrypted": &schema.Schema{

View File

@ -49,6 +49,25 @@ func TestAccAWSDBInstance_basic(t *testing.T) {
})
}
func TestAccAWSDBInstance_withoutEngineVersion(t *testing.T) {
var v rds.DBInstance
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSDBInstanceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccAWSDBInstanceConfig,
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSDBInstanceExists("aws_db_instance.bar", &v),
testAccCheckAWSDBInstanceAttributes(&v),
),
},
},
})
}
func TestAccAWSDBInstanceReplica(t *testing.T) {
var s, r rds.DBInstance
@ -194,6 +213,28 @@ resource "aws_db_instance" "bar" {
parameter_group_name = "default.mysql5.6"
}`, rand.New(rand.NewSource(time.Now().UnixNano())).Int())
var testAccAWSDBInstanceConfig_withoutEngineVersion = fmt.Sprintf(`
resource "aws_db_instance" "bar" {
identifier = "foobarbaz-test-terraform-%d"
allocated_storage = 10
engine = "MySQL"
instance_class = "db.t1.micro"
name = "baz"
password = "barbarbarbar"
username = "foo"
# Maintenance Window is stored in lower case in the API, though not strictly
# documented. Terraform will downcase this to match (as opposed to throw a
# validation error).
maintenance_window = "Fri:09:00-Fri:09:30"
backup_retention_period = 0
parameter_group_name = "default.mysql5.6"
}`, rand.New(rand.NewSource(time.Now().UnixNano())).Int())
func testAccReplicaInstanceConfig(val int) string {
return fmt.Sprintf(`
resource "aws_db_instance" "bar" {

View File

@ -36,7 +36,7 @@ The following arguments are supported:
* `allocated_storage` - (Required) The allocated storage in gigabytes.
* `engine` - (Required) The database engine to use.
* `engine_version` - (Required) The engine version to use.
* `engine_version` - (Optional) The engine version to use.
* `identifier` - (Required) The name of the RDS instance
* `instance_class` - (Required) The instance type of the RDS instance.
* `storage_type` - (Optional) One of "standard" (magnetic), "gp2" (general