Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

t/db_instance: Run acceptance tests in default region #2618

Merged
merged 3 commits into from
Dec 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 45 additions & 11 deletions aws/resource_aws_db_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func TestAccAWSDBInstance_iamAuth(t *testing.T) {
})
}

func TestAccAWSDBInstanceReplica(t *testing.T) {
func TestAccAWSDBInstance_replica(t *testing.T) {
var s, r rds.DBInstance

resource.Test(t, resource.TestCase{
Expand All @@ -214,7 +214,7 @@ func TestAccAWSDBInstanceReplica(t *testing.T) {
})
}

func TestAccAWSDBInstanceNoSnapshot(t *testing.T) {
func TestAccAWSDBInstance_noSnapshot(t *testing.T) {
var snap rds.DBInstance

resource.Test(t, resource.TestCase{
Expand All @@ -232,7 +232,7 @@ func TestAccAWSDBInstanceNoSnapshot(t *testing.T) {
})
}

func TestAccAWSDBInstanceSnapshot(t *testing.T) {
func TestAccAWSDBInstance_snapshot(t *testing.T) {
var snap rds.DBInstance
rInt := acctest.RandInt()

Expand Down Expand Up @@ -411,6 +411,25 @@ func TestAccAWSDBInstance_diffSuppressInitialState(t *testing.T) {
})
}

func TestAccAWSDBInstance_ec2Classic(t *testing.T) {
var v rds.DBInstance
rInt := acctest.RandInt()

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t); testAccEC2ClassicPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSDBInstanceDestroy,
Steps: []resource.TestStep{
{
Config: testAccAWSDBInstanceConfigEc2Classic(rInt),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSDBInstanceExists("aws_db_instance.bar", &v),
),
},
},
})
}

func testAccCheckAWSDBInstanceDestroy(s *terraform.State) error {
conn := testAccProvider.Meta().(*AWSClient).rdsconn

Expand Down Expand Up @@ -855,9 +874,6 @@ func testAccReplicaInstanceConfig(val int) string {

func testAccSnapshotInstanceConfig() string {
return fmt.Sprintf(`
provider "aws" {
region = "us-east-1"
}
resource "aws_db_instance" "snapshot" {
identifier = "tf-test-%d"

Expand All @@ -868,7 +884,6 @@ resource "aws_db_instance" "snapshot" {
name = "baz"
password = "barbarbarbar"
username = "foo"
security_group_names = ["default"]
backup_retention_period = 1

publicly_accessible = true
Expand All @@ -882,9 +897,6 @@ resource "aws_db_instance" "snapshot" {

func testAccSnapshotInstanceConfigWithSnapshot(rInt int) string {
return fmt.Sprintf(`
provider "aws" {
region = "us-east-1"
}
resource "aws_db_instance" "snapshot" {
identifier = "tf-snapshot-%d"

Expand All @@ -896,7 +908,6 @@ resource "aws_db_instance" "snapshot" {
password = "barbarbarbar"
publicly_accessible = true
username = "foo"
security_group_names = ["default"]
backup_retention_period = 1

parameter_group_name = "default.mysql5.6"
Expand Down Expand Up @@ -1346,6 +1357,29 @@ resource "aws_db_instance" "bar" {
}
`, acctest.RandInt())

func testAccAWSDBInstanceConfigEc2Classic(rInt int) string {
return fmt.Sprintf(`
provider "aws" {
region = "us-east-1"
}

resource "aws_db_instance" "bar" {
identifier = "foobarbaz-test-terraform-%d"
allocated_storage = 10
engine = "mysql"
engine_version = "5.6"
instance_class = "db.m3.medium"
name = "baz"
password = "barbarbarbar"
username = "foo"
publicly_accessible = true
security_group_names = ["default"]
parameter_group_name = "default.mysql5.6"
skip_final_snapshot = true
}
`, rInt)
}

func testAccAWSDBInstanceConfigSuppressInitialState(rInt int) string {
return fmt.Sprintf(`
resource "aws_db_instance" "bar" {
Expand Down