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

tests/service/rds: Remove hardcoded instance classes from EC2-Classic tests and basic data source test #15184

Merged
merged 1 commit into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
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
32 changes: 28 additions & 4 deletions aws/data_source_aws_db_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,17 @@ func TestAccAWSDbInstanceDataSource_ec2Classic(t *testing.T) {

func testAccAWSDBInstanceDataSourceConfig(rInt int) string {
return fmt.Sprintf(`
data "aws_rds_orderable_db_instance" "test" {
engine = "mariadb"
preferred_instance_classes = ["db.t3.micro", "db.t2.micro", "db.t3.small"]
}

resource "aws_db_instance" "bar" {
identifier = "datasource-test-terraform-%d"

allocated_storage = 10
engine = "mariadb"
instance_class = "db.t2.micro"
engine = data.aws_rds_orderable_db_instance.test.engine
instance_class = data.aws_rds_orderable_db_instance.test.instance_class
name = "baz"
password = "barbarbarbar"
username = "foo"
Expand All @@ -95,10 +100,29 @@ data "aws_db_instance" "bar" {

func testAccAWSDBInstanceDataSourceConfig_ec2Classic(rInt int) string {
return fmt.Sprintf(`
%s
data "aws_rds_orderable_db_instance" "test" {
engine = "mysql"
engine_version = "5.6.41"
preferred_instance_classes = ["db.m3.medium", "db.m3.large", "db.r3.large"]
}

resource "aws_db_instance" "bar" {
identifier = "foobarbaz-test-terraform-%[1]d"
allocated_storage = 10
engine = data.aws_rds_orderable_db_instance.test.engine
engine_version = data.aws_rds_orderable_db_instance.test.engine_version
instance_class = data.aws_rds_orderable_db_instance.test.instance_class
name = "baz"
password = "barbarbarbar"
username = "foo"
publicly_accessible = true
security_group_names = ["default"]
parameter_group_name = "default.mysql5.6"
skip_final_snapshot = true
}

data "aws_db_instance" "bar" {
db_instance_identifier = aws_db_instance.bar.identifier
}
`, testAccAWSDBInstanceConfigEc2Classic(rInt))
`, rInt)
}
14 changes: 10 additions & 4 deletions aws/resource_aws_db_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4559,12 +4559,18 @@ resource "aws_db_instance" "bar" {

func testAccAWSDBInstanceConfigEc2Classic(rInt int) string {
return fmt.Sprintf(`
data "aws_rds_orderable_db_instance" "test" {
engine = "mysql"
engine_version = "5.6.41"
preferred_instance_classes = ["db.m3.medium", "db.m3.large", "db.r3.large"]
}

resource "aws_db_instance" "bar" {
identifier = "foobarbaz-test-terraform-%d"
identifier = "foobarbaz-test-terraform-%[1]d"
allocated_storage = 10
engine = "mysql"
engine_version = "5.6"
instance_class = "db.m5.large"
engine = data.aws_rds_orderable_db_instance.test.engine
engine_version = data.aws_rds_orderable_db_instance.test.engine_version
instance_class = data.aws_rds_orderable_db_instance.test.instance_class
name = "baz"
password = "barbarbarbar"
username = "foo"
Expand Down