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

TestTerraformAwsRdsExample intermittently failing due to instance type #783

Closed
brikis98 opened this issue Feb 15, 2021 · 5 comments
Closed
Labels
bug Something isn't working

Comments

@brikis98
Copy link
Member

TestTerraformAwsRdsExample 2021-02-15T15:38:50Z logger.go:66: �[0m�[1maws_db_instance.example: Creating...�[0m�[0m
TestTerraformAwsRdsExample 2021-02-15T15:38:52Z logger.go:66: �[0m�[1maws_security_group_rule.allow_db_access: Creation complete after 2s [id=sgrule-374035581]�[0m�[0m
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66: �[31m
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66: �[1m�[31mError: �[0m�[0m�[1mError creating DB Instance: InvalidParameterValue: Invalid DB Instance class: db.t2.micro
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66: 	status code: 400, request id: 18246674-2cc7-4541-8d38-c4f726962eb3, {
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   AllocatedStorage: 5,
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   AutoMinorVersionUpgrade: true,
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   BackupRetentionPeriod: 0,
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   CopyTagsToSnapshot: false,
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   DBInstanceClass: "db.t2.micro",
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   DBInstanceIdentifier: "terratest-aws-rds-example-61t4py",
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   DBName: "terratest",
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   DBParameterGroupName: "terratest-aws-rds-example-61t4py",
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   DBSubnetGroupName: "terratest-aws-rds-example-61t4py",
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   DeletionProtection: false,
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   Engine: "mysql",
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   EngineVersion: "5.7.21",
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   LicenseModel: "general-public-license",
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   MasterUserPassword: "********",
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   MasterUsername: "username",
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   OptionGroupName: "terratest-aws-rds-example-61t4py",
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   Port: 3306,
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   PubliclyAccessible: true,
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   StorageEncrypted: false,
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   Tags: [{
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:       Key: "Name",
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:       Value: "terratest-aws-rds-example-61t4py"
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:     }],
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66:   VpcSecurityGroupIds: ["sg-08f256be2b7a134b4"]
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66: }�[0m
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66: 
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z logger.go:66: �[0m�[0m�[0m
TestTerraformAwsRdsExample 2021-02-15T15:38:55Z retry.go:99: Returning due to fatal error: FatalError{Underlying: error while running command: exit status 1; �[31m
�[1m�[31mError: �[0m�[0m�[1mError creating DB Instance: InvalidParameterValue: Invalid DB Instance class: db.t2.micro
}�[0m

�[0m�[0m�[0m}

Looks like some regions no longer have db.t2.micro, so when the test randomly picks one such region, it fails (the test run above used eu-north-1).

@alpacamybags118
Copy link
Contributor

I could take a look at this. I'm guessing if there is an endpoint where we can get a list of a valid db instance types for a particular region, we could query that then just pick one.

@brikis98
Copy link
Member Author

Thanks! We actually already have a solution for this for EC2 instance types, so we probably need something similar for RDS:

func GetRecommendedInstanceType(t testing.TestingT, region string, instanceTypeOptions []string) string {

@alpacamybags118
Copy link
Contributor

I started working on this today. I plan on using https://docs.aws.amazon.com/sdk-for-go/api/service/rds/#RDS.DescribeOrderableDBInstanceOptions to get a list of valid instances for the region/db engine and finding a match based on the user's provided list of instances, similar to the ec2 implementation. I'll try to get a pr in for this within the next week.

@brikis98
Copy link
Member Author

Roger, thx!

@brikis98
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants