Skip to content

Commit

Permalink
Add field s3 path to google_storage_transfer_job
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwamizamurai committed May 11, 2023
1 parent 8a6de6a commit 266a833
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,11 @@ func awsS3DataSchema() *schema.Resource {
Type: schema.TypeString,
Description: `S3 Bucket name.`,
},
"path": {
Required: true,
Type: schema.TypeString,
Description: `S3 Bucket path in bucket to transfer.`,
},
"aws_access_key": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -940,16 +945,22 @@ func expandAwsS3Data(awsS3Datas []interface{}) *storagetransfer.AwsS3Data {
}

awsS3Data := awsS3Datas[0].(map[string]interface{})
return &storagetransfer.AwsS3Data{
var apiData = &storagetransfer.AwsS3Data{
BucketName: awsS3Data["bucket_name"].(string),
AwsAccessKey: expandAwsAccessKeys(awsS3Data["aws_access_key"].([]interface{})),
RoleArn: awsS3Data["role_arn"].(string),
}

var path = gcsData["path"].(string)
apiData.Path = path

return apiData
}

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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 266a833

Please sign in to comment.