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

Rename s3_bucket_object to s3_object #22850

Merged
merged 17 commits into from
Jan 31, 2022
2 changes: 1 addition & 1 deletion .semgrep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/s3-cross-account-access/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/sagemaker/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),

Expand Down Expand Up @@ -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(),
Expand Down
10 changes: 5 additions & 5 deletions internal/service/apigateway/domain_name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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"),
),
},
{
Expand Down Expand Up @@ -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"
Expand All @@ -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))
Expand Down
16 changes: 8 additions & 8 deletions internal/service/apigatewayv2/domain_name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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"),
),
},
Expand All @@ -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"),
),
},
Expand Down Expand Up @@ -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"
Expand All @@ -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))
Expand All @@ -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"
Expand All @@ -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))
Expand Down
8 changes: 4 additions & 4 deletions internal/service/cloudformation/stack_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"))
}
Expand Down Expand Up @@ -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

Expand All @@ -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"))
}
Expand Down
8 changes: 4 additions & 4 deletions internal/service/cloudformation/stack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
}
Expand Down Expand Up @@ -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"
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions internal/service/cloudformation/type_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions internal/service/cloudformation/type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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

Expand All @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions internal/service/codebuild/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down Expand Up @@ -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"
Expand All @@ -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"
}
}
Expand Down
8 changes: 4 additions & 4 deletions internal/service/configservice/conformance_pack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <<EOT
Expand All @@ -675,7 +675,7 @@ EOT
resource "aws_config_conformance_pack" "test" {
depends_on = [aws_config_configuration_recorder.test]
name = %q
template_s3_uri = "s3://${aws_s3_bucket.test.bucket}/${aws_s3_bucket_object.test.id}"
template_s3_uri = "s3://${aws_s3_bucket.test.bucket}/${aws_s3_object.test.id}"
}
`, bucketName, rName))
}
Expand All @@ -689,7 +689,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 = <<EOT
Expand Down Expand Up @@ -717,7 +717,7 @@ Resources:
SourceIdentifier: IAM_PASSWORD_POLICY
Type: AWS::Config::ConfigRule
EOT
template_s3_uri = "s3://${aws_s3_bucket.test.bucket}/${aws_s3_bucket_object.test.id}"
template_s3_uri = "s3://${aws_s3_bucket.test.bucket}/${aws_s3_object.test.id}"
}
`, rName))
}
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ func testAccOrganizationConformancePackS3TemplateConfig(rName, bName string) str
resource "aws_config_organization_conformance_pack" "test" {
depends_on = [aws_config_configuration_recorder.test, aws_organizations_organization.test]
name = %q
template_s3_uri = "s3://${aws_s3_bucket.test.id}/${aws_s3_bucket_object.test.id}"
template_s3_uri = "s3://${aws_s3_bucket.test.id}/${aws_s3_object.test.id}"
}

resource "aws_s3_bucket" "test" {
Expand All @@ -653,7 +653,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 = %[2]q
content = <<EOT
Expand Down
Loading