From ac2c60794ee47015e96270d3bf6d3833b0503edb Mon Sep 17 00:00:00 2001 From: kiwamizamurai Date: Tue, 16 May 2023 09:57:15 +0900 Subject: [PATCH] Add field s3 path to google_storage_transfer_job (#7932) * Add field s3 path to google_storage_transfer_job * chore: remove unnecessary variables * feat: make field optional * fix: the way to make field optional * fix: prepare awsS3Data * fix alignment --- .../terraform/resources/resource_storage_transfer_job.go | 7 +++++++ .../website/docs/r/storage_transfer_job.html.markdown | 2 ++ 2 files changed, 9 insertions(+) diff --git a/mmv1/third_party/terraform/resources/resource_storage_transfer_job.go b/mmv1/third_party/terraform/resources/resource_storage_transfer_job.go index 0900252aad3d..3cae9eef3f15 100644 --- a/mmv1/third_party/terraform/resources/resource_storage_transfer_job.go +++ b/mmv1/third_party/terraform/resources/resource_storage_transfer_job.go @@ -443,6 +443,11 @@ func awsS3DataSchema() *schema.Resource { Type: schema.TypeString, Description: `S3 Bucket name.`, }, + "path": { + Optional: true, + Type: schema.TypeString, + Description: `S3 Bucket path in bucket to transfer.`, + }, "aws_access_key": { Type: schema.TypeList, Optional: true, @@ -944,12 +949,14 @@ func expandAwsS3Data(awsS3Datas []interface{}) *storagetransfer.AwsS3Data { BucketName: awsS3Data["bucket_name"].(string), AwsAccessKey: expandAwsAccessKeys(awsS3Data["aws_access_key"].([]interface{})), RoleArn: awsS3Data["role_arn"].(string), + Path: awsS3Data["path"].(string), } } func flattenAwsS3Data(awsS3Data *storagetransfer.AwsS3Data, d *schema.ResourceData) []map[string]interface{} { data := map[string]interface{}{ "bucket_name": awsS3Data.BucketName, + "path": awsS3Data.Path, "role_arn": awsS3Data.RoleArn, } if awsS3Data.AwsAccessKey != nil { diff --git a/mmv1/third_party/terraform/website/docs/r/storage_transfer_job.html.markdown b/mmv1/third_party/terraform/website/docs/r/storage_transfer_job.html.markdown index 16ff6bca33e3..4d03338c69be 100644 --- a/mmv1/third_party/terraform/website/docs/r/storage_transfer_job.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/storage_transfer_job.html.markdown @@ -211,6 +211,8 @@ A duration in seconds with up to nine fractional digits, terminated by 's'. Exam * `bucket_name` - (Required) S3 Bucket name. +* `path` - (Optional) Root path to transfer objects. Must be an empty string or full path name that ends with a '/'. This field is treated as an object prefix. As such, it should generally not begin with a '/'. + * `aws_access_key` - (Optional) AWS credentials block. * `role_arn` - (Optional) The Amazon Resource Name (ARN) of the role to support temporary credentials via 'AssumeRoleWithWebIdentity'. For more information about ARNs, see [IAM ARNs](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-arns). When a role ARN is provided, Transfer Service fetches temporary credentials for the session using a 'AssumeRoleWithWebIdentity' call for the provided role using the [GoogleServiceAccount][] for this project.