Skip to content

Commit

Permalink
Add field s3 path to google_storage_transfer_job (GoogleCloudPlatform…
Browse files Browse the repository at this point in the history
…#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
  • Loading branch information
kiwamizamurai authored and ericayyliu committed Jul 26, 2023
1 parent 429a2f8 commit ac2c607
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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": {
Optional: true,
Type: schema.TypeString,
Description: `S3 Bucket path in bucket to transfer.`,
},
"aws_access_key": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -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 {
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 ac2c607

Please sign in to comment.