diff --git a/.semgrep.yml b/.semgrep.yml index b9b3814753c..076d19b86e9 100644 --- a/.semgrep.yml +++ b/.semgrep.yml @@ -568,7 +568,7 @@ rules: - internal/service/mq/forge_test.go - internal/service/route53/sweep.go - internal/service/s3/bucket_test.go - - internal/service/s3/bucket_object_test.go + - internal/service/s3/object_test.go - internal/service/storagegateway/cached_iscsi_volume.go - internal/service/storagegateway/cached_iscsi_volume_test.go - internal/service/storagegateway/stored_iscsi_volume_test.go diff --git a/examples/s3-cross-account-access/main.tf b/examples/s3-cross-account-access/main.tf index 178f9131b00..ddae63032fa 100644 --- a/examples/s3-cross-account-access/main.tf +++ b/examples/s3-cross-account-access/main.tf @@ -34,7 +34,7 @@ resource "aws_s3_bucket" "prod" { POLICY } -resource "aws_s3_bucket_object" "prod" { +resource "aws_s3_object" "prod" { provider = aws.prod bucket = aws_s3_bucket.prod.id @@ -50,7 +50,7 @@ provider "aws" { secret_key = var.test_secret_key } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { provider = aws.test bucket = aws_s3_bucket.prod.id diff --git a/examples/sagemaker/main.tf b/examples/sagemaker/main.tf index ded75b3b90e..2babe537ee2 100644 --- a/examples/sagemaker/main.tf +++ b/examples/sagemaker/main.tf @@ -86,7 +86,7 @@ resource "aws_s3_bucket" "foo" { force_destroy = true } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.foo.bucket key = "model.tar.gz" source = "model.tar.gz" diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 7e495efc9c0..90d0a9c1d82 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -685,8 +685,8 @@ func Provider() *schema.Provider { "aws_canonical_user_id": s3.DataSourceCanonicalUserID(), "aws_s3_bucket": s3.DataSourceBucket(), - "aws_s3_bucket_object": s3.DataSourceBucketObject(), - "aws_s3_bucket_objects": s3.DataSourceBucketObjects(), + "aws_s3_object": s3.DataSourceObject(), + "aws_s3_objects": s3.DataSourceObjects(), "aws_sagemaker_prebuilt_ecr_image": sagemaker.DataSourcePrebuiltECRImage(), @@ -1593,12 +1593,12 @@ func Provider() *schema.Provider { "aws_s3_bucket_inventory": s3.ResourceBucketInventory(), "aws_s3_bucket_metric": s3.ResourceBucketMetric(), "aws_s3_bucket_notification": s3.ResourceBucketNotification(), - "aws_s3_bucket_object": s3.ResourceBucketObject(), "aws_s3_bucket_ownership_controls": s3.ResourceBucketOwnershipControls(), "aws_s3_bucket_policy": s3.ResourceBucketPolicy(), "aws_s3_bucket_public_access_block": s3.ResourceBucketPublicAccessBlock(), "aws_s3_bucket_replication_configuration": s3.ResourceBucketReplicationConfiguration(), "aws_s3_bucket_versioning": s3.ResourceBucketVersioning(), + "aws_s3_object": s3.ResourceObject(), "aws_s3_object_copy": s3.ResourceObjectCopy(), "aws_s3_access_point": s3control.ResourceAccessPoint(), diff --git a/internal/service/apigateway/domain_name_test.go b/internal/service/apigateway/domain_name_test.go index ac8db5fac72..8534ded436e 100644 --- a/internal/service/apigateway/domain_name_test.go +++ b/internal/service/apigateway/domain_name_test.go @@ -305,7 +305,7 @@ func TestAccAPIGatewayDomainName_mutualTLSAuthentication(t *testing.T) { var v apigateway.DomainName resourceName := "aws_api_gateway_domain_name.test" acmCertificateResourceName := "aws_acm_certificate.test" - s3BucketObjectResourceName := "aws_s3_bucket_object.test" + s3ObjectResourceName := "aws_s3_object.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -322,7 +322,7 @@ func TestAccAPIGatewayDomainName_mutualTLSAuthentication(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "domain_name", acmCertificateResourceName, "domain_name"), resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.#", "1"), resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.0.truststore_uri", fmt.Sprintf("s3://%s/%s", rName, rName)), - resource.TestCheckResourceAttrPair(resourceName, "mutual_tls_authentication.0.truststore_version", s3BucketObjectResourceName, "version_id"), + resource.TestCheckResourceAttrPair(resourceName, "mutual_tls_authentication.0.truststore_version", s3ObjectResourceName, "version_id"), ), }, { @@ -647,7 +647,7 @@ resource "aws_s3_bucket" "test" { } } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { bucket = aws_s3_bucket.test.id key = %[1]q source = "test-fixtures/apigateway-domain-name-truststore-1.pem" @@ -663,8 +663,8 @@ resource "aws_api_gateway_domain_name" "test" { } mutual_tls_authentication { - truststore_uri = "s3://${aws_s3_bucket_object.test.bucket}/${aws_s3_bucket_object.test.key}" - truststore_version = aws_s3_bucket_object.test.version_id + truststore_uri = "s3://${aws_s3_object.test.bucket}/${aws_s3_object.test.key}" + truststore_version = aws_s3_object.test.version_id } } `, rName)) diff --git a/internal/service/apigatewayv2/domain_name_test.go b/internal/service/apigatewayv2/domain_name_test.go index 1cd042d3902..933bd93dcb1 100644 --- a/internal/service/apigatewayv2/domain_name_test.go +++ b/internal/service/apigatewayv2/domain_name_test.go @@ -221,7 +221,7 @@ func TestAccAPIGatewayV2DomainName_mutualTLSAuthentication(t *testing.T) { var v apigatewayv2.GetDomainNameOutput resourceName := "aws_apigatewayv2_domain_name.test" acmCertificateResourceName := "aws_acm_certificate.test" - s3BucketObjectResourceName := "aws_s3_bucket_object.test" + s3ObjectResourceName := "aws_s3_object.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -262,7 +262,7 @@ func TestAccAPIGatewayV2DomainName_mutualTLSAuthentication(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "domain_name_configuration.0.target_domain_name"), resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.#", "1"), resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.0.truststore_uri", fmt.Sprintf("s3://%s/%s", rName, rName)), - resource.TestCheckResourceAttrPair(resourceName, "mutual_tls_authentication.0.truststore_version", s3BucketObjectResourceName, "version_id"), + resource.TestCheckResourceAttrPair(resourceName, "mutual_tls_authentication.0.truststore_version", s3ObjectResourceName, "version_id"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, @@ -280,7 +280,7 @@ func TestAccAPIGatewayV2DomainName_mutualTLSAuthentication(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "domain_name_configuration.0.target_domain_name"), resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.#", "1"), resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.0.truststore_uri", fmt.Sprintf("s3://%s/%s", rName, rName)), - resource.TestCheckResourceAttrPair(resourceName, "mutual_tls_authentication.0.truststore_version", s3BucketObjectResourceName, "version_id"), + resource.TestCheckResourceAttrPair(resourceName, "mutual_tls_authentication.0.truststore_version", s3ObjectResourceName, "version_id"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, @@ -469,7 +469,7 @@ resource "aws_s3_bucket" "test" { force_destroy = true } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { bucket = aws_s3_bucket.test.id key = %[1]q source = "test-fixtures/%[2]s" @@ -485,7 +485,7 @@ resource "aws_apigatewayv2_domain_name" "test" { } mutual_tls_authentication { - truststore_uri = "s3://${aws_s3_bucket_object.test.bucket}/${aws_s3_bucket_object.test.key}" + truststore_uri = "s3://${aws_s3_object.test.bucket}/${aws_s3_object.test.key}" } } `, rName, pemFileName)) @@ -505,7 +505,7 @@ resource "aws_s3_bucket" "test" { } } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { bucket = aws_s3_bucket.test.id key = %[1]q source = "test-fixtures/%[2]s" @@ -521,8 +521,8 @@ resource "aws_apigatewayv2_domain_name" "test" { } mutual_tls_authentication { - truststore_uri = "s3://${aws_s3_bucket_object.test.bucket}/${aws_s3_bucket_object.test.key}" - truststore_version = aws_s3_bucket_object.test.version_id + truststore_uri = "s3://${aws_s3_object.test.bucket}/${aws_s3_object.test.key}" + truststore_version = aws_s3_object.test.version_id } } `, rName, pemFileName)) diff --git a/internal/service/cloudformation/stack_set_test.go b/internal/service/cloudformation/stack_set_test.go index 1cafd48cc2d..10fb87fd5c0 100644 --- a/internal/service/cloudformation/stack_set_test.go +++ b/internal/service/cloudformation/stack_set_test.go @@ -1348,7 +1348,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { acl = "public-read" bucket = aws_s3_bucket.test.bucket @@ -1362,7 +1362,7 @@ CONTENT resource "aws_cloudformation_stack_set" "test" { administration_role_arn = aws_iam_role.test.arn name = %[1]q - template_url = "https://${aws_s3_bucket.test.bucket_regional_domain_name}/${aws_s3_bucket_object.test.key}" + template_url = "https://${aws_s3_bucket.test.bucket_regional_domain_name}/${aws_s3_object.test.key}" } `, rName, testAccStackSetTemplateBodyVPC(rName+"1")) } @@ -1397,7 +1397,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { acl = "public-read" bucket = aws_s3_bucket.test.bucket @@ -1411,7 +1411,7 @@ CONTENT resource "aws_cloudformation_stack_set" "test" { administration_role_arn = aws_iam_role.test.arn name = %[1]q - template_url = "https://${aws_s3_bucket.test.bucket_regional_domain_name}/${aws_s3_bucket_object.test.key}" + template_url = "https://${aws_s3_bucket.test.bucket_regional_domain_name}/${aws_s3_object.test.key}" } `, rName, testAccStackSetTemplateBodyVPC(rName+"2")) } diff --git a/internal/service/cloudformation/stack_test.go b/internal/service/cloudformation/stack_test.go index 48af97c0bb8..fab244b7513 100644 --- a/internal/service/cloudformation/stack_test.go +++ b/internal/service/cloudformation/stack_test.go @@ -859,7 +859,7 @@ POLICY } } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.b.id key = %[2]q source = "test-fixtures/cloudformation-template.json" @@ -872,7 +872,7 @@ resource "aws_cloudformation_stack" "test" { VpcCIDR = %[3]q } - template_url = "https://${aws_s3_bucket.b.id}.s3-${data.aws_region.current.name}.${data.aws_partition.current.dns_suffix}/${aws_s3_bucket_object.object.key}" + template_url = "https://${aws_s3_bucket.b.id}.s3-${data.aws_region.current.name}.${data.aws_partition.current.dns_suffix}/${aws_s3_object.object.key}" on_failure = "DELETE" timeout_in_minutes = 1 } @@ -913,7 +913,7 @@ POLICY } } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.b.id key = %[2]q source = "test-fixtures/cloudformation-template.yaml" @@ -926,7 +926,7 @@ resource "aws_cloudformation_stack" "test" { VpcCIDR = %[3]q } - template_url = "https://${aws_s3_bucket.b.id}.s3-${data.aws_region.current.name}.${data.aws_partition.current.dns_suffix}/${aws_s3_bucket_object.object.key}" + template_url = "https://${aws_s3_bucket.b.id}.s3-${data.aws_region.current.name}.${data.aws_partition.current.dns_suffix}/${aws_s3_object.object.key}" on_failure = "DELETE" timeout_in_minutes = 1 } diff --git a/internal/service/cloudformation/type_data_source_test.go b/internal/service/cloudformation/type_data_source_test.go index f646af0da16..94d3dc8483c 100644 --- a/internal/service/cloudformation/type_data_source_test.go +++ b/internal/service/cloudformation/type_data_source_test.go @@ -150,14 +150,14 @@ resource "aws_s3_bucket" "test" { force_destroy = true } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { bucket = aws_s3_bucket.test.bucket key = "test" source = %[2]q } resource "aws_cloudformation_type" "test" { - schema_handler_package = "s3://${aws_s3_bucket_object.test.bucket}/${aws_s3_bucket_object.test.key}" + schema_handler_package = "s3://${aws_s3_object.test.bucket}/${aws_s3_object.test.key}" type = "RESOURCE" type_name = %[3]q } diff --git a/internal/service/cloudformation/type_test.go b/internal/service/cloudformation/type_test.go index 4f6b555f8a3..89ea941f2da 100644 --- a/internal/service/cloudformation/type_test.go +++ b/internal/service/cloudformation/type_test.go @@ -377,7 +377,7 @@ resource "aws_s3_bucket" "test" { force_destroy = true } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { bucket = aws_s3_bucket.test.bucket key = "test" source = %[2]q @@ -406,7 +406,7 @@ resource "aws_iam_role" "test" { resource "aws_cloudformation_type" "test" { execution_role_arn = aws_iam_role.test.arn - schema_handler_package = "s3://${aws_s3_bucket_object.test.bucket}/${aws_s3_bucket_object.test.key}" + schema_handler_package = "s3://${aws_s3_object.test.bucket}/${aws_s3_object.test.key}" type = "RESOURCE" type_name = %[2]q } @@ -437,7 +437,7 @@ resource "aws_iam_role" "test" { } resource "aws_cloudformation_type" "test" { - schema_handler_package = "s3://${aws_s3_bucket_object.test.bucket}/${aws_s3_bucket_object.test.key}" + schema_handler_package = "s3://${aws_s3_object.test.bucket}/${aws_s3_object.test.key}" type = "RESOURCE" type_name = %[2]q @@ -454,7 +454,7 @@ func testAccCloudformationTypeConfigTypeName(rName string, zipPath string, typeN testAccCloudformationTypeConfigBase(rName, zipPath), fmt.Sprintf(` resource "aws_cloudformation_type" "test" { - schema_handler_package = "s3://${aws_s3_bucket_object.test.bucket}/${aws_s3_bucket_object.test.key}" + schema_handler_package = "s3://${aws_s3_object.test.bucket}/${aws_s3_object.test.key}" type = "RESOURCE" type_name = %[1]q } diff --git a/internal/service/codebuild/project_test.go b/internal/service/codebuild/project_test.go index 9917c2399a4..2cfa74ad4a1 100644 --- a/internal/service/codebuild/project_test.go +++ b/internal/service/codebuild/project_test.go @@ -3171,7 +3171,7 @@ resource "aws_s3_bucket" "test" { force_destroy = true } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { bucket = aws_s3_bucket.test.bucket key = %[1]q content = "test" @@ -3189,7 +3189,7 @@ resource "aws_codebuild_project" "test" { compute_type = "BUILD_GENERAL1_SMALL" image = "2" type = "LINUX_CONTAINER" - certificate = "${aws_s3_bucket.test.bucket}/${aws_s3_bucket_object.test.key}" + certificate = "${aws_s3_bucket.test.bucket}/${aws_s3_object.test.key}" } source { @@ -3956,7 +3956,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { bucket = aws_s3_bucket.test.bucket content = "test" key = "test.txt" @@ -3977,7 +3977,7 @@ resource "aws_codebuild_project" "test" { } source { - location = "${aws_s3_bucket.test.bucket}/${aws_s3_bucket_object.test.key}" + location = "${aws_s3_bucket.test.bucket}/${aws_s3_object.test.key}" type = "S3" } } diff --git a/internal/service/configservice/conformance_pack_test.go b/internal/service/configservice/conformance_pack_test.go index 28141d408bd..ba32d579170 100644 --- a/internal/service/configservice/conformance_pack_test.go +++ b/internal/service/configservice/conformance_pack_test.go @@ -657,7 +657,7 @@ resource "aws_s3_bucket" "test" { force_destroy = true } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { bucket = aws_s3_bucket.test.id key = %[1]q content = < **NOTE on `max_keys`:** Retrieving very large numbers of keys can adversely affect Terraform's performance. -The bucket-objects data source returns keys (i.e., file names) and other metadata about objects in an S3 bucket. +The objects data source returns keys (i.e., file names) and other metadata about objects in an S3 bucket. ## Example Usage The following example retrieves a list of all object keys in an S3 bucket and creates corresponding Terraform object data sources: ```terraform -data "aws_s3_bucket_objects" "my_objects" { +data "aws_s3_objects" "my_objects" { bucket = "ourcorp" } -data "aws_s3_bucket_object" "object_info" { - count = length(data.aws_s3_bucket_objects.my_objects.keys) - key = element(data.aws_s3_bucket_objects.my_objects.keys, count.index) - bucket = data.aws_s3_bucket_objects.my_objects.bucket +data "aws_s3_object" "object_info" { + count = length(data.aws_s3_objects.my_objects.keys) + key = element(data.aws_s3_objects.my_objects.keys, count.index) + bucket = data.aws_s3_objects.my_objects.bucket } ``` diff --git a/website/docs/r/cloudformation_type.html.markdown b/website/docs/r/cloudformation_type.html.markdown index b3819d49c16..c4dd058d23a 100644 --- a/website/docs/r/cloudformation_type.html.markdown +++ b/website/docs/r/cloudformation_type.html.markdown @@ -16,7 +16,7 @@ Manages a version of a CloudFormation Type. ```terraform resource "aws_cloudformation_type" "example" { - schema_handler_package = "s3://${aws_s3_bucket_object.example.bucket}/${aws_s3_bucket_object.example.key}" + schema_handler_package = "s3://${aws_s3_object.example.bucket}/${aws_s3_object.example.key}" type = "RESOURCE" type_name = "ExampleCompany::ExampleService::ExampleResource" diff --git a/website/docs/r/cloudtrail.html.markdown b/website/docs/r/cloudtrail.html.markdown index b9f861a5083..363aadab7d9 100644 --- a/website/docs/r/cloudtrail.html.markdown +++ b/website/docs/r/cloudtrail.html.markdown @@ -70,7 +70,7 @@ POLICY ### Data Event Logging -CloudTrail can log [Data Events](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html) for certain services such as S3 bucket objects and Lambda function invocations. Additional information about data event configuration can be found in the following links: +CloudTrail can log [Data Events](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html) for certain services such as S3 objects and Lambda function invocations. Additional information about data event configuration can be found in the following links: * [CloudTrail API DataResource documentation](https://docs.aws.amazon.com/awscloudtrail/latest/APIReference/API_DataResource.html) (for basic event selector). * [CloudTrail API AdvancedFieldSelector documentation](https://docs.aws.amazon.com/awscloudtrail/latest/APIReference/API_AdvancedFieldSelector.html) (for advanced event selector). @@ -93,7 +93,7 @@ resource "aws_cloudtrail" "example" { } ``` -#### Logging All S3 Bucket Object Events By Using Basic Event Selectors +#### Logging All S3 Object Events By Using Basic Event Selectors ```terraform resource "aws_cloudtrail" "example" { @@ -136,7 +136,7 @@ resource "aws_cloudtrail" "example" { } ``` -#### Logging All S3 Bucket Object Events Except For Two S3 Buckets By Using Advanced Event Selectors +#### Logging All S3 Object Events Except For Two S3 Buckets By Using Advanced Event Selectors ```terraform data "aws_s3_bucket" "not-important-bucket-1" { @@ -151,7 +151,7 @@ resource "aws_cloudtrail" "example" { # ... other configuration ... advanced_event_selector { - name = "Log all S3 buckets objects events except for two S3 buckets" + name = "Log all S3 objects events except for two S3 buckets" field_selector { field = "eventCategory" diff --git a/website/docs/r/config_conformance_pack.html.markdown b/website/docs/r/config_conformance_pack.html.markdown index 3f135afec28..ac10f34fd48 100644 --- a/website/docs/r/config_conformance_pack.html.markdown +++ b/website/docs/r/config_conformance_pack.html.markdown @@ -53,7 +53,7 @@ EOT ```terraform resource "aws_config_conformance_pack" "example" { name = "example" - template_s3_uri = "s3://${aws_s3_bucket.example.bucket}/${aws_s3_bucket_object.example.key}" + template_s3_uri = "s3://${aws_s3_bucket.example.bucket}/${aws_s3_object.example.key}" depends_on = [aws_config_configuration_recorder.example] } @@ -62,7 +62,7 @@ resource "aws_s3_bucket" "example" { bucket = "example" } -resource "aws_s3_bucket_object" "example" { +resource "aws_s3_object" "example" { bucket = aws_s3_bucket.example.id key = "example-key" content = <