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

r/aws_s3_bucket_object: Enable source to be an s3 source #6383

Closed
wants to merge 1 commit into from

Conversation

YakDriver
Copy link
Member

@YakDriver YakDriver commented Nov 7, 2018

Updated Sep 1, 2020
Fixes #3943

Changes proposed in this pull request:

  • resource/aws_s3_bucket_object: allow the source attribute to be an s3 URL (instead of just a file)

For example, with this PR, this would be possible (copying object from one s3 bucket to another s3 bucket):

resource "aws_s3_bucket" "source_bucket" {
  bucket = "tf-object-test-bucket-1111"
}

resource "aws_s3_bucket_object" "source_object" {
  bucket  = aws_s3_bucket.source_bucket.id
  key     = "object-to-copy"
  content = "Jelly Bean"
}

resource "aws_s3_bucket" "dest_bucket" {
  bucket = "tf-object-test-bucket-5555"
}

resource "aws_s3_bucket_object" "dest_object" {
  bucket = aws_s3_bucket.dest_bucket.id
  key    = "copied-object"
  source = "s3://${aws_s3_bucket.source_bucket.id}/${aws_s3_bucket_object.source_object.id}"
}

GovCloud acceptance testing (Sep 1 2020):

--- PASS: TestAccAWSS3BucketObject_s3SourceBasic (32.72s)
--- PASS: TestAccAWSS3BucketObject_s3SourceWithContentCharacteristics (32.72s)

Commercial acceptance testing (Sep 1 2020):

--- PASS: TestAccAWSS3BucketObject_s3SourceBasic (29.52s)
--- PASS: TestAccAWSS3BucketObject_s3SourceWithContentCharacteristics (29.62s)

@ghost ghost added size/XL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. service/s3 Issues and PRs that pertain to the s3 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Nov 7, 2018
@bflad bflad added the enhancement Requests to existing resources that expand the functionality or scope. label Nov 7, 2018
@YakDriver
Copy link
Member Author

YakDriver commented Nov 7, 2018

Mar 21, 2019: Comment changed due to new development

When copying s3 objects, metadata will also be copied or updated based on arguments provided in config.

For example:
* If the source object has content_language set to en and in the copy, content_language is not set, the copied object will have content_language set to en.
* If the source object has content_language set to en and in the copy, content_language is set to es, the copied object will have content_language set to es (updating the metadata).

@YakDriver YakDriver force-pushed the s3-source branch 3 times, most recently from b072d08 to 6e02d97 Compare November 7, 2018 20:35
@YakDriver
Copy link
Member Author

YakDriver commented Nov 7, 2018

To address the issue in the previous comment, I've added this note to the docs in this PR:

Note: When copying an S3 object, some attributes will be copied that cannot be changed, such as content_language, cache_control, and content_encoding. To avoid Terraform reporting differences between your configuration and infrastructure when doing a subsequent apply, include these attributes in your configuration with the same values as the copied object.

@YakDriver
Copy link
Member Author

@bflad any chance of getting a look at this? 😃 🦃

@YakDriver
Copy link
Member Author

@bflad This is rebased and ready for a look! 👁

@lorengordon
Copy link
Contributor

Would love to be able to use this. Getting tiresome to have to download every object locally first.

@YakDriver YakDriver force-pushed the s3-source branch 2 times, most recently from b3f9857 to 4553646 Compare March 21, 2019 15:09
@YakDriver
Copy link
Member Author

YakDriver commented Mar 21, 2019

Old acceptance tests...

@YakDriver YakDriver force-pushed the s3-source branch 3 times, most recently from 4eae5d0 to 0aeb3de Compare March 21, 2019 21:18
@aeschright aeschright requested a review from a team June 25, 2019 21:36
@bflad bflad self-assigned this Jun 26, 2019
@YakDriver
Copy link
Member Author

YakDriver commented Jul 24, 2019

Rebased and TF 0.12 issues addressed. Acceptance tests are passing:

@YakDriver
Copy link
Member Author

@bflad @ryndaniels Conflicts resolved. Let me know if you'd like any adjust.

@YakDriver YakDriver force-pushed the s3-source branch 2 times, most recently from 2311550 to 4ca5881 Compare October 2, 2019 18:12
@YakDriver
Copy link
Member Author

@bflad This is a friendly ping 🏓 . We'd love to be able to use this!

@lorengordon
Copy link
Contributor

@bflad @aeschright is this on the radar to review/merge?

@YakDriver YakDriver added the partition/aws-us-gov Pertains to the aws-us-gov partition. label Aug 27, 2020
@YakDriver YakDriver marked this pull request as draft August 27, 2020 15:46
@YakDriver
Copy link
Member Author

YakDriver commented Sep 1, 2020

The main update today was pairing down acceptance tests to functionality that really needed to be tested with the additional functionality. Previous tests were excessive.

GovCloud acceptance testing:

--- PASS: TestAccAWSS3BucketObject_s3SourceBasic (32.72s)
--- PASS: TestAccAWSS3BucketObject_s3SourceWithContentCharacteristics (32.72s)

Commercial acceptance testing:

--- PASS: TestAccAWSS3BucketObject_s3SourceBasic (29.52s)
--- PASS: TestAccAWSS3BucketObject_s3SourceWithContentCharacteristics (29.62s)

@ghost ghost added size/L Managed by automation to categorize the size of a PR. and removed size/XL Managed by automation to categorize the size of a PR. labels Sep 1, 2020
@YakDriver YakDriver marked this pull request as ready for review September 1, 2020 19:35
@bflad
Copy link
Contributor

bflad commented Nov 9, 2020

Closing in preference of #15461

@bflad bflad closed this Nov 9, 2020
@ghost
Copy link

ghost commented Dec 9, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. partition/aws-us-gov Pertains to the aws-us-gov partition. service/s3 Issues and PRs that pertain to the s3 service. size/L Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support s3:// URIs in "source" field for aws_s3_bucket_object resource
3 participants