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

provider/aws: Add S3 Bucket Object (supercedes #2079) #2898

Merged
merged 7 commits into from
Aug 5, 2015

Conversation

catsby
Copy link
Contributor

@catsby catsby commented Jul 30, 2015

Supersedes #2079:

  • Merges master (as of 6e7c612)
  • Uses the key instead of the returned etag. The reason here is that the etag is typically the md5 of the object, but not if you supply your own encryption keys for the object. While we don't support that yet, I don't want to add it in the future and then mess up existing objects
  • Adds S3 Bucket Object to the docs sidebar
  • Documents etag
  • Swaps out awslabs for aws

m-s-austin and others added 5 commits May 26, 2015 10:46
* master: (720 commits)
  Update CHANGELOG.md
  Update CHANGELOG.md
  dynamodb-local Update AWS config #2825 (comment)
  Make target_pools optional
  Update CHANGELOG.md
  code formatting
  Update CHANGELOG.md
  providers/google: Fix reading account_file path
  providers/google: Fix error appending
  providers/google: Return if we could parse JSON
  providers/google: Change account_file to JSON
  providers/google: Default account_file* to empty
  providers/google: Add account_file/account_file_contents ConflictsWith
  providers/google: Document account_file_contents
  providers/google: Use account_file_contents if provided
  providers/google: Add account_file_contents to provider
  Update CHANGELOG.md
  Update CHANGELOG.md
  dynamodb-local Use ` instead of : to refer region to keep the consistency with the provider docs
  dynamodb-local Update aws provider docs to include the `dynamodb_endpoint` argument
  ...
d.SetId("")
log.Printf("Error Reading Object (%s): %s", key, err)
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems perhaps a little too wide of a net for the error. Like if I have a wifi hiccup I don't want TF to assume objects are gone. Can we scope this down to an "Object Not Found" error and return anything else?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tried to scope this, but with no luck:

log.Printf("\n\n--- Error: %#v\n------\n", err)
if awsErr, ok := err.(awserr.Error); ok {
    log.Printf("\n\n-----\n AWS ERror here:\n\tCode: %s\n\tMessage: %s", awsErr.Code(), awsErr.Message())

    log.Printf("\n\n-----\n main error: %s", err.Error())
}

Response:

: --- Error: &awserr.requestError{awsError:(*awserr.baseError)(0xc208348b10), statusCode:404, requestID:""}
: ------
: 2015/08/03 10:06:44
:
: -----
:  AWS ERror here:
:   Code:
:   Message:

😱

@phinze I did check GetObject (instead of HeadObject), which does return NoSuchKey for the code. I'm not sure if we should switch though, because of the included network traffic for potentially larger objects. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@catsby from that output it looks like something like this would work for a scope:

if awsErr, ok := err.(awserr.RequestError); ok && awsErr.StatusCode == 404 {
  // ...
}

Similar to how we do it for S3 Buckets. err.(awserr.RequestFailure) might work too, which would make us able to use literally the same snippet.

Let me know what you think.

…r-2079

* upstream/master:
  Update CHANGELOG.md
  Update CHANGELOG.md
  provider/aws: allow external ENI attachments
  Update AWS provider documentation
  docs/aws: Fix example of aws_iam_role_policy
  provider/aws: S3 bucket test that should fail
  provider/aws: Return if Bucket not found
  Update CHANGELOG.md
  Update CHANGELOG.md
  helper/schema: record schema version when destroy fails
  settings file is not required
  provider/azure: Allow settings_file to accept XML string
  add note to aws_iam_policy_attachment explaining its use/limitations
  docs: clarify template_file path information
  google: Sort resources by alphabet in docs
  Support go get in go 1.5
  Update CHANGELOG.md
  aws_network_interface attachment block is not required
  provider/aws: Fix issue in Security Group Rules where the Security Group is not found
@catsby catsby force-pushed the f-aws-s3-object-pr-2079 branch from 7cefd53 to 9abd59a Compare August 5, 2015 19:27
@catsby catsby force-pushed the f-aws-s3-object-pr-2079 branch from 9abd59a to bfaea76 Compare August 5, 2015 19:27
catsby added a commit that referenced this pull request Aug 5, 2015
provider/aws: Add S3 Bucket Object (supercedes #2079)
@catsby catsby merged commit 56e2894 into master Aug 5, 2015
@mitchellh mitchellh deleted the f-aws-s3-object-pr-2079 branch March 22, 2016 19:19
bmcustodio pushed a commit to bmcustodio/terraform that referenced this pull request Sep 26, 2017
website: adding production hardening guide
@ghost
Copy link

ghost commented Apr 27, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants