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

linter: add rule to discourage data source referencing resource Read #18821

Merged
merged 2 commits into from
Apr 15, 2021

Conversation

anGie44
Copy link
Contributor

@anGie44 anGie44 commented Apr 13, 2021

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

Preceded by #18838, #18842, #18844, #18846, and #18848
Closes #18819

Output from running semgrep (currently):

ran 19 rules on 2427 files: 0 findings

@ghost ghost added size/XS Managed by automation to categorize the size of a PR. labels Apr 13, 2021
@anGie44 anGie44 added the linter Pertains to changes to or issues with the various linters. label Apr 13, 2021
@anGie44 anGie44 force-pushed the td-linter-for-data-source-reads branch 2 times, most recently from a988114 to a0f9e5f Compare April 13, 2021 17:15
@anGie44 anGie44 marked this pull request as ready for review April 14, 2021 01:24
@anGie44 anGie44 requested a review from a team as a code owner April 14, 2021 01:24
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.

Looks good to me once all the fixes are in. 🚀

.semgrep.yml Outdated Show resolved Hide resolved
.semgrep.yml Outdated
- aws/data_source_aws_*.go
patterns:
- pattern: $RESOURCE_READ
- pattern-inside: func $FUNCNAME(...) error { ... }
Copy link
Contributor

Choose a reason for hiding this comment

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

This will need to be updated for diag.Diagnostics (or a separate rule created) to support context-aware functions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ahh true! would it be too generalized of a rule if i replace error with something like $RETURNTYPE instead?

@bflad bflad self-assigned this Apr 14, 2021
@anGie44 anGie44 requested a review from ewbankkit as a code owner April 15, 2021 20:20
@ghost ghost added size/XXL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. service/cloudhsmv2 Issues and PRs that pertain to the cloudhsmv2 service. service/costandusagereportservice service/dynamodb Issues and PRs that pertain to the dynamodb service. service/ec2 Issues and PRs that pertain to the ec2 service. service/elb Issues and PRs that pertain to the elb service. service/elbv2 Issues and PRs that pertain to the elbv2 service. service/iam Issues and PRs that pertain to the iam service. service/kms Issues and PRs that pertain to the kms service. service/mq Issues and PRs that pertain to the mq service. service/route53resolver Issues and PRs that pertain to the route53resolver service. service/sfn Issues and PRs that pertain to the sfn service. service/sns Issues and PRs that pertain to the sns service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. and removed size/XS Managed by automation to categorize the size of a PR. labels Apr 15, 2021
@anGie44
Copy link
Contributor Author

anGie44 commented Apr 15, 2021

..welp...didn't realize what branch i was on..will fix this up

@anGie44 anGie44 force-pushed the td-linter-for-data-source-reads branch from 558573f to 5d44679 Compare April 15, 2021 20:57
@ghost ghost added size/L Managed by automation to categorize the size of a PR. labels Apr 15, 2021
@anGie44 anGie44 force-pushed the td-linter-for-data-source-reads branch 2 times, most recently from f25fa67 to a4436a9 Compare April 15, 2021 21:05
@ghost ghost added size/M Managed by automation to categorize the size of a PR. size/L Managed by automation to categorize the size of a PR. and removed size/L Managed by automation to categorize the size of a PR. size/M Managed by automation to categorize the size of a PR. labels Apr 15, 2021
@anGie44 anGie44 force-pushed the td-linter-for-data-source-reads branch from a4436a9 to 4200ec3 Compare April 15, 2021 21:09
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. and removed size/M Managed by automation to categorize the size of a PR. labels Apr 15, 2021
@ghost ghost added size/M Managed by automation to categorize the size of a PR. size/XS Managed by automation to categorize the size of a PR. and removed size/XS Managed by automation to categorize the size of a PR. size/M Managed by automation to categorize the size of a PR. labels Apr 15, 2021
@anGie44 anGie44 removed the request for review from ewbankkit April 15, 2021 21:55
@anGie44 anGie44 added this to the v3.37.0 milestone Apr 15, 2021
@anGie44 anGie44 merged commit ca33f82 into main Apr 15, 2021
@anGie44 anGie44 deleted the td-linter-for-data-source-reads branch April 15, 2021 21:55
@ghost
Copy link

ghost commented Apr 16, 2021

This has been released in version 3.37.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 May 16, 2021

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 May 16, 2021
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. linter Pertains to changes to or issues with the various linters. provider Pertains to the provider itself, rather than any interaction with AWS. service/cloudhsmv2 Issues and PRs that pertain to the cloudhsmv2 service. service/dynamodb Issues and PRs that pertain to the dynamodb service. service/ec2 Issues and PRs that pertain to the ec2 service. service/elb Issues and PRs that pertain to the elb service. service/elbv2 Issues and PRs that pertain to the elbv2 service. service/iam Issues and PRs that pertain to the iam service. service/kms Issues and PRs that pertain to the kms service. service/mq Issues and PRs that pertain to the mq service. service/route53resolver Issues and PRs that pertain to the route53resolver service. service/sfn Issues and PRs that pertain to the sfn service. service/sns Issues and PRs that pertain to the sns 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.

Add Linter to Avoid Resource Function References in Data Sources
2 participants