provider/aws: Randomize DB Identifier in test

Getting name collisions every now and again
This commit is contained in:
clint shryock 2016-04-18 10:00:59 -05:00
parent d75d67d035
commit a810edd7a6
1 changed files with 6 additions and 4 deletions

View File

@ -100,7 +100,7 @@ func TestAccAWSDBInstanceNoSnapshot(t *testing.T) {
CheckDestroy: testAccCheckAWSDBInstanceNoSnapshot, CheckDestroy: testAccCheckAWSDBInstanceNoSnapshot,
Steps: []resource.TestStep{ Steps: []resource.TestStep{
resource.TestStep{ resource.TestStep{
Config: testAccNoSnapshotInstanceConfig, Config: testAccNoSnapshotInstanceConfig(),
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccCheckAWSDBInstanceExists("aws_db_instance.no_snapshot", &nosnap), testAccCheckAWSDBInstanceExists("aws_db_instance.no_snapshot", &nosnap),
), ),
@ -447,12 +447,13 @@ resource "aws_db_instance" "snapshot" {
}`, acctest.RandInt()) }`, acctest.RandInt())
} }
var testAccNoSnapshotInstanceConfig = ` func testAccNoSnapshotInstanceConfig() string {
return fmt.Sprintf(`
provider "aws" { provider "aws" {
region = "us-east-1" region = "us-east-1"
} }
resource "aws_db_instance" "no_snapshot" { resource "aws_db_instance" "no_snapshot" {
identifier = "foobarbaz-test-terraform-snapshot-2" identifier = "tf-test-%s"
allocated_storage = 5 allocated_storage = 5
engine = "mysql" engine = "mysql"
@ -469,7 +470,8 @@ resource "aws_db_instance" "no_snapshot" {
skip_final_snapshot = true skip_final_snapshot = true
final_snapshot_identifier = "foobarbaz-test-terraform-final-snapshot-2" final_snapshot_identifier = "foobarbaz-test-terraform-final-snapshot-2"
} }
` `, acctest.RandString(5))
}
var testAccSnapshotInstanceConfig_enhancedMonitoring = ` var testAccSnapshotInstanceConfig_enhancedMonitoring = `
resource "aws_iam_role" "enhanced_policy_role" { resource "aws_iam_role" "enhanced_policy_role" {