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

resource/aws_s3_bucket_policy: add import ability #6543

Merged
merged 1 commit into from
Nov 25, 2018

Conversation

acburdine
Copy link
Contributor

closes #6519

Changes proposed in this pull request:

  • Add import ability for aws_s3_bucket_policy

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSS3BucketPolicy'
=== RUN   TestAccAWSS3BucketPolicy_basic
=== PAUSE TestAccAWSS3BucketPolicy_basic
=== RUN   TestAccAWSS3BucketPolicy_policyUpdate
=== PAUSE TestAccAWSS3BucketPolicy_policyUpdate
=== CONT  TestAccAWSS3BucketPolicy_basic
=== CONT  TestAccAWSS3BucketPolicy_policyUpdate
--- PASS: TestAccAWSS3BucketPolicy_basic (22.30s)
--- PASS: TestAccAWSS3BucketPolicy_policyUpdate (32.38s)
PASS

@ghost ghost added size/XS Managed by automation to categorize the size of a PR. 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 21, 2018
@@ -86,6 +89,9 @@ func resourceAwsS3BucketPolicyRead(d *schema.ResourceData, meta interface{}) err
if err := d.Set("policy", v); err != nil {
return err
}
if err := d.Set("bucket", d.Id()); err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bflad not sure if this will break anything - had to do it in order for import to work correctly though.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a valid (non-breaking) change, thanks!

@@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"github.com/jen20/awspolicyequivalence"
awspolicy "github.com/jen20/awspolicyequivalence"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

goimports added this automatically, let me know if I need to revert the change.

@ghost ghost added the documentation Introduces or discusses updates to documentation. label Nov 21, 2018
@bflad bflad added the enhancement Requests to existing resources that expand the functionality or scope. label Nov 21, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

LGTM with the one minor little formatting fix on merge, thanks @acburdine! 🚀

--- PASS: TestAccAWSS3BucketPolicy_basic (28.39s)
--- PASS: TestAccAWSS3BucketPolicy_policyUpdate (44.97s)

@@ -86,6 +89,9 @@ func resourceAwsS3BucketPolicyRead(d *schema.ResourceData, meta interface{}) err
if err := d.Set("policy", v); err != nil {
return err
}
if err := d.Set("bucket", d.Id()); err != 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 is a valid (non-breaking) change, thanks!


## Import
S3 bucket policies can be imported using the bucket name, e.g.
```
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like an extra space snuck in here, which would likely break the page formatting. Maybe someday we'll get markdownlint running against pull requests to catch this. 😅 I'll fix this on merge.

@bflad bflad added this to the v1.47.0 milestone Nov 25, 2018
@bflad bflad merged commit 2b4f06f into hashicorp:master Nov 25, 2018
bflad added a commit that referenced this pull request Nov 25, 2018
@acburdine acburdine deleted the feat/s3_bucket_policy_import branch November 26, 2018 13:22
@bflad
Copy link
Contributor

bflad commented Nov 30, 2018

This was released (4 days ago) in version 1.47.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 2, 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 and limited conversation to collaborators Apr 2, 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. service/s3 Issues and PRs that pertain to the s3 service. size/XS 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 bucket policy import
2 participants