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

tests/provider: Enable tfproviderlint R004 check #11499

Merged
merged 2 commits into from
Feb 5, 2020
Merged

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Jan 6, 2020

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #9954
Requires:

Release note for CHANGELOG:

NONE

The additional import_aws_s3_bucket.go fix was the last remaining linter issue:

/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/import_aws_s3_bucket.go:36:22: R004: ResourceData.Set() incompatible value type: *github.com/aws/aws-sdk-go/service/s3.GetBucketPolicyOutput
35		pData.Set("bucket", d.Id())
36		pData.Set("policy", pol)
37		results = append(results, pData)

The aws_s3_bucket resource implements what we refer to as a "complex" import with multiple resources, which has been discouraged for a long time now and will likely be removed (along with the handful of other resources that do the same) in a future major version of the provider. I found and marked issues related to that with the 3.0.0 milestone for now. The fix, while valid, has little real consequence in practice since import performs an immediate refresh of the relevant Terraform resources immediately after import in recent versions of Terraform unless refresh is explicitly disabled (which is strongly discouraged in the Terraform CLI documentation) so its not really worth a CHANGELOG mention.

Output from relevant acceptance testing (other tests do not perform necessary ImportStateCheck to verify the complex import):

--- PASS: TestAccAWSS3Bucket_Policy (95.74s)

@bflad bflad added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. provider Pertains to the provider itself, rather than any interaction with AWS. labels Jan 6, 2020
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. size/XS Managed by automation to categorize the size of a PR. labels Jan 6, 2020
@bflad bflad removed the needs-triage Waiting for first response or review from a maintainer. label Jan 6, 2020
… properly set policy in state

Found via linting:

```
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/import_aws_s3_bucket.go:36:22: R004: ResourceData.Set() incompatible value type: *github.com/aws/aws-sdk-go/service/s3.GetBucketPolicyOutput
35		pData.Set("bucket", d.Id())
36		pData.Set("policy", pol)
37		results = append(results, pData)
```

This type of complex import (importing multiple resources) is likely to be removed in a future major version.

Output from relevant acceptance testing (other tests do not perform necessary ImportStateCheck to verify complex import):

```
--- PASS: TestAccAWSS3Bucket_Policy (95.74s)
```
@ghost ghost added the service/s3 Issues and PRs that pertain to the s3 service. label Feb 5, 2020
@bflad bflad marked this pull request as ready for review February 5, 2020 02:01
@bflad bflad requested a review from a team February 5, 2020 02:01
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

--- PASS: TestAccAWSS3Bucket_Policy (61.49s)

@bflad bflad added this to the v2.48.0 milestone Feb 5, 2020
@bflad bflad merged commit 82b8834 into master Feb 5, 2020
@bflad bflad deleted the t-tfproviderlint-R004 branch February 5, 2020 21:11
@ghost
Copy link

ghost commented Feb 7, 2020

This has been released in version 2.48.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Mar 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 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 Mar 27, 2020
@breathingdust breathingdust added the linter Pertains to changes to or issues with the various linters. label Oct 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
linter Pertains to changes to or issues with the various linters. provider Pertains to the provider itself, rather than any interaction with AWS. 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.

Fix and enable tfproviderlint R004 check: Ensure compatible types for Set() calls
3 participants