-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
r/aws_athena_database: validate athena db name with regex as per docs #4133
Conversation
add test cases for possible db names
add testcase for uppercase name refactor test config to one func
@@ -81,7 +117,7 @@ func testAccCheckAWSAthenaDatabaseDestroy(s *terraform.State) error { | |||
} | |||
|
|||
rInt := acctest.RandInt() | |||
bucketName := fmt.Sprintf("tf-athena-db-%s-%d", rs.Primary.Attributes["name"], rInt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case where I had an _
in the db name, creating a bucket with that name in it caused an error, the random integer should be sufficient in ensuring a unique bucketName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
5 tests passed (all tests)
=== RUN TestAccAWSAthenaDatabase_nameCantHaveUppercase
--- PASS: TestAccAWSAthenaDatabase_nameCantHaveUppercase (0.99s)
=== RUN TestAccAWSAthenaDatabase_basic
--- PASS: TestAccAWSAthenaDatabase_basic (31.25s)
=== RUN TestAccAWSAthenaDatabase_nameStartsWithUnderscore
--- PASS: TestAccAWSAthenaDatabase_nameStartsWithUnderscore (32.78s)
=== RUN TestAccAWSAthenaDatabase_forceDestroyAlwaysSucceeds
--- PASS: TestAccAWSAthenaDatabase_forceDestroyAlwaysSucceeds (36.63s)
=== RUN TestAccAWSAthenaDatabase_destroyFailsIfTablesExist
--- PASS: TestAccAWSAthenaDatabase_destroyFailsIfTablesExist (41.79s)
This has been released in version 1.15.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Fix #4128
Validate athena db name with regex as per docs (also wrap name in SQL syntax with `` to support leading underscore as per docs)
https://docs.aws.amazon.com/athena/latest/ug/tables-databases-columns-names.html
Also simplify config to 1 function