diff --git a/aws/resource_aws_cloudfront_distribution_test.go b/aws/resource_aws_cloudfront_distribution_test.go index b0d1cf3c1baa..193f81205053 100644 --- a/aws/resource_aws_cloudfront_distribution_test.go +++ b/aws/resource_aws_cloudfront_distribution_test.go @@ -1248,8 +1248,9 @@ resource "aws_s3_bucket" "s3_backup_bucket_origin" { var logBucket = ` resource "aws_s3_bucket" "s3_bucket_logs" { - bucket = "mylogs.${var.rand_id}" - acl = "public-read" + acl = "public-read" + bucket = "mylogs.${var.rand_id}" + force_destroy = true } ` diff --git a/aws/resource_aws_msk_cluster_test.go b/aws/resource_aws_msk_cluster_test.go index 4efd96dbf689..98419019ff02 100644 --- a/aws/resource_aws_msk_cluster_test.go +++ b/aws/resource_aws_msk_cluster_test.go @@ -1242,8 +1242,9 @@ resource "aws_cloudwatch_log_group" "test" { } resource "aws_s3_bucket" "bucket" { - bucket = %[1]q - acl = "private" + acl = "private" + bucket = %[1]q + force_destroy = true } resource "aws_iam_role" "firehose_role" { diff --git a/docs/contributing/running-and-writing-acceptance-tests.md b/docs/contributing/running-and-writing-acceptance-tests.md index 208a1cc309a0..f85cc3542c54 100644 --- a/docs/contributing/running-and-writing-acceptance-tests.md +++ b/docs/contributing/running-and-writing-acceptance-tests.md @@ -1215,6 +1215,7 @@ The below are required items that will be noted during submission review and pre - [ ] __Uses resource.ParallelTest__: Tests should utilize [`resource.ParallelTest()`](https://godoc.org/github.com/hashicorp/terraform/helper/resource#ParallelTest) instead of [`resource.Test()`](https://godoc.org/github.com/hashicorp/terraform/helper/resource#Test) except where serialized testing is absolutely required. - [ ] __Uses fmt.Sprintf()__: Test configurations preferably should to be separated into their own functions (typically named `testAccAws{SERVICE}{RESOURCE}Config{PURPOSE}`) that call [`fmt.Sprintf()`](https://golang.org/pkg/fmt/#Sprintf) for variable injection or a string `const` for completely static configurations. Test configurations should avoid `var` or other variable injection functionality such as [`text/template`](https://golang.org/pkg/text/template/). - [ ] __Uses Randomized Infrastructure Naming__: Test configurations that utilize resources where a unique name is required should generate a random name. Typically this is created via `rName := acctest.RandomWithPrefix("tf-acc-test")` in the acceptance test function before generating the configuration. +- [ ] __Prevents S3 Bucket Deletion Errors__: Test configurations that utilize `aws_s3_bucket` resources as a logging destination should include the `force_destroy = true` configuration. This is to prevent race conditions where logging objects may be written during the testing duration which will cause `BucketNotEmpty` errors during deletion. For resources that support import, the additional item below is required that will be noted during submission review and prevent immediate merging: