|
|
|
|
@ -20,6 +20,27 @@ func TestAccAWSRDSCluster_basic(t *testing.T) {
|
|
|
|
|
ri := rand.New(rand.NewSource(time.Now().UnixNano())).Int()
|
|
|
|
|
config := fmt.Sprintf(testAccAWSClusterConfig, ri)
|
|
|
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
|
Providers: testAccProviders,
|
|
|
|
|
CheckDestroy: testAccCheckAWSClusterDestroy,
|
|
|
|
|
Steps: []resource.TestStep{
|
|
|
|
|
resource.TestStep{
|
|
|
|
|
Config: config,
|
|
|
|
|
Check: resource.ComposeTestCheckFunc(
|
|
|
|
|
testAccCheckAWSClusterExists("aws_rds_cluster.default", &v),
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestAccAWSRDSCluster_backups(t *testing.T) {
|
|
|
|
|
var v rds.DBCluster
|
|
|
|
|
|
|
|
|
|
ri := rand.New(rand.NewSource(time.Now().UnixNano())).Int()
|
|
|
|
|
config := fmt.Sprintf(testAccAWSClusterConfig_backups, ri)
|
|
|
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
|
Providers: testAccProviders,
|
|
|
|
|
@ -41,12 +62,12 @@ func TestAccAWSRDSCluster_basic(t *testing.T) {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestAccAWSRDSCluster_update(t *testing.T) {
|
|
|
|
|
func TestAccAWSRDSCluster_backupsUpdate(t *testing.T) {
|
|
|
|
|
var v rds.DBCluster
|
|
|
|
|
|
|
|
|
|
ri := rand.New(rand.NewSource(time.Now().UnixNano())).Int()
|
|
|
|
|
preConfig := fmt.Sprintf(testAccAWSClusterConfig, ri)
|
|
|
|
|
postConfig := fmt.Sprintf(testAccAWSClusterConfig_update, ri)
|
|
|
|
|
preConfig := fmt.Sprintf(testAccAWSClusterConfig_backups, ri)
|
|
|
|
|
postConfig := fmt.Sprintf(testAccAWSClusterConfig_backupsUpdate, ri)
|
|
|
|
|
|
|
|
|
|
resource.Test(t, resource.TestCase{
|
|
|
|
|
PreCheck: func() { testAccPreCheck(t) },
|
|
|
|
|
@ -147,8 +168,16 @@ func testAccCheckAWSClusterExists(n string, v *rds.DBCluster) resource.TestCheck
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add some random to the name, to avoid collision
|
|
|
|
|
var testAccAWSClusterConfig = `
|
|
|
|
|
resource "aws_rds_cluster" "default" {
|
|
|
|
|
cluster_identifier = "tf-aurora-cluster-%d"
|
|
|
|
|
availability_zones = ["us-west-2a","us-west-2b","us-west-2c"]
|
|
|
|
|
database_name = "mydb"
|
|
|
|
|
master_username = "foo"
|
|
|
|
|
master_password = "mustbeeightcharaters"
|
|
|
|
|
}`
|
|
|
|
|
|
|
|
|
|
var testAccAWSClusterConfig_backups = `
|
|
|
|
|
resource "aws_rds_cluster" "default" {
|
|
|
|
|
cluster_identifier = "tf-aurora-cluster-%d"
|
|
|
|
|
availability_zones = ["us-west-2a","us-west-2b","us-west-2c"]
|
|
|
|
|
@ -160,8 +189,7 @@ resource "aws_rds_cluster" "default" {
|
|
|
|
|
preferred_maintenance_window = "tue:04:00-tue:04:30"
|
|
|
|
|
}`
|
|
|
|
|
|
|
|
|
|
// Add some random to the name, to avoid collision
|
|
|
|
|
var testAccAWSClusterConfig_update = `
|
|
|
|
|
var testAccAWSClusterConfig_backupsUpdate = `
|
|
|
|
|
resource "aws_rds_cluster" "default" {
|
|
|
|
|
cluster_identifier = "tf-aurora-cluster-%d"
|
|
|
|
|
availability_zones = ["us-west-2a","us-west-2b","us-west-2c"]
|
|
|
|
|
|