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

Fix and enable tfproviderlint R005 check: Combine multiple d.HasChange() calls with d.HasChanges() call #11863

Closed
bflad opened this issue Feb 3, 2020 · 2 comments · Fixed by #12811
Labels
linter Pertains to changes to or issues with the various linters. technical-debt Addresses areas of the codebase that need refactoring or redesign.
Milestone

Comments

@bflad
Copy link
Contributor

bflad commented Feb 3, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue 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 issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

The Terraform Plugin SDK recently introduced a simplifying d.HasChanges() call to replace multiple OR'd d.HasChange(). See also: https://github.com/bflad/tfproviderlint/blob/master/passes/R005/README.md

e.g.

/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/autoscaling_tags.go:59:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_acm_certificate.go:295:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_cloudtrail.go:318:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_codedeploy_deployment_group.go:676:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_datasync_task.go:279:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_db_instance.go:1468:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_db_instance.go:1625:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_db_instance.go:1633:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_db_subnet_group.go:169:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_dms_endpoint.go:423:6: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_dms_endpoint.go:461:6: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_docdb_subnet_group.go:154:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_dynamodb_table.go:476:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_dynamodb_table.go:492:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_ec2_transit_gateway_vpc_attachment.go:213:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_ec2_transit_gateway_vpc_attachment.go:243:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_ec2_transit_gateway_vpc_attachment_accepter.go:192:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_ecs_cluster.go:259:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_ecs_service.go:910:6: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_efs_file_system.go:204:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_eip.go:294:14: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_eip.go:311:13: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_eks_cluster.go:366:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_eks_node_group.go:340:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_eks_node_group.go:372:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_elasticache_subnet_group.go:130:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_elasticsearch_domain.go:724:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_elb.go:584:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_elb.go:628:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_emr_instance_group.go:289:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_gamelift_fleet.go:338:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_globalaccelerator_accelerator.go:239:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_glue_catalog_database.go:111:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_glue_crawler.go:461:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_glue_job.go:302:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_glue_trigger.go:306:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_iam_group.go:101:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_iam_user.go:141:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_lambda_function.go:192:9: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_media_convert_queue.go:175:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_mq_broker.go:405:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_neptune_subnet_group.go:165:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_ram_resource_share.go:134:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_rds_cluster_instance.go:498:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_redshift_cluster.go:664:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_redshift_subnet_group.go:139:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_route53_health_check.go:180:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_route53_resolver_rule.go:193:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_s3_bucket_object.go:449:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_secretsmanager_secret.go:261:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_secretsmanager_secret.go:307:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_storagegateway_gateway.go:400:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_transfer_server.go:213:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_vpc_peering_connection.go:230:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_waf_web_acl.go:283:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_wafregional_rate_based_rule.go:174:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_wafregional_web_acl.go:300:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call
/Users/bflad/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_worklink_fleet.go:237:5: R005: multiple ResourceData.HasChange() calls can be combined with single HasChanges() call

Definition of Done

  • Fix R005 reports
  • In GNUmakefile, add -R005 to tfproviderlint command under lint target and have TravisCI testing pass
@bflad bflad added the technical-debt Addresses areas of the codebase that need refactoring or redesign. label Feb 3, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Feb 3, 2020
@bflad bflad removed the needs-triage Waiting for first response or review from a maintainer. label Feb 3, 2020
bflad added a commit that referenced this issue Feb 3, 2020
Gaps in `tfproviderlint` checking are covered by the following issues:

Reference: #9950 (fix and enable AT003)
Reference: #11862 (fix and enable AT005)
Reference: #9951 (fix and enable R001)
Reference: #9952 (fix and enable R002)
Reference: #9953 (fix and enable R003)
Reference: #9954 (fix and enable R004)
Reference: #11863 (fix and enable R005)
Reference: #11864 (fix and enable R006)
Reference: #9955 (fix and enable S006)
Reference: #9956 (fix and enable S018)
Reference: #11865 (fix and enable S020)
Reference: #11866 (fix and enable S022)
Reference: #11867 (fix and enable S023)
Reference: #11868 (fix and enable S024)
Reference: #11869 (fix and enable S031)
Reference: #11870 (fix and enable S032)
Reference: #11871 (fix and enable S033)
Reference: #11872 (fix and enable V001)
Reference: #11844 (fix and enable V002, V004, V005, V007, V008)
bflad added a commit that referenced this issue Feb 4, 2020
Gaps in `tfproviderlint` checking are covered by the following issues:

Reference: #9950 (fix and enable AT003)
Reference: #11862 (fix and enable AT005)
Reference: #9951 (fix and enable R001)
Reference: #9952 (fix and enable R002)
Reference: #9953 (fix and enable R003)
Reference: #9954 (fix and enable R004)
Reference: #11863 (fix and enable R005)
Reference: #11864 (fix and enable R006)
Reference: #9955 (fix and enable S006)
Reference: #9956 (fix and enable S018)
Reference: #11865 (fix and enable S020)
Reference: #11866 (fix and enable S022)
Reference: #11867 (fix and enable S023)
Reference: #11868 (fix and enable S024)
Reference: #11869 (fix and enable S031)
Reference: #11870 (fix and enable S032)
Reference: #11871 (fix and enable S033)
Reference: #11872 (fix and enable V001)
Reference: #11844 (fix and enable V002, V004, V005, V007, V008)
bflad added a commit that referenced this issue Feb 19, 2020
Reference: #12074

Gaps in `tfproviderlint`/`awsproviderlint` checking are covered by the following issues:

Reference: #11888 (fix and enable AWSAT001)
Reference: #9950 (fix and enable AT003)
Reference: #11862 (fix and enable AT005)
Reference: #9951 (fix and enable R001)
Reference: #9952 (fix and enable R002)
Reference: #9953 (fix and enable R003)
Reference: #11863 (fix and enable R005)
Reference: #11864 (fix and enable R006)
Reference: #12083 (fix and enable R007, R008)
Reference: #9955 (fix and enable S006)
Reference: #9956 (fix and enable S018)
Reference: #11865 (fix and enable S020)
Reference: #11866 (fix and enable S022)
Reference: #11867 (fix and enable S023)
Reference: #11868 (fix and enable S024)
Reference: #11869 (fix and enable S031)
Reference: #11870 (fix and enable S032)
Reference: #11871 (fix and enable S033)
Reference: #11872 (fix and enable V001)
Reference: #11844 (fix and enable V002, V004, V005, V007, V008)
bflad added a commit that referenced this issue Mar 10, 2020
Reference: #12074

Gaps in `tfproviderlint`/`awsproviderlint` checking are covered by the following issues:

Reference: #11888 (fix and enable AWSAT001)
Reference: #9950 (fix and enable AT003)
Reference: #11862 (fix and enable AT005)
Reference: #9951 (fix and enable R001)
Reference: #9952 (fix and enable R002)
Reference: #9953 (fix and enable R003)
Reference: #11863 (fix and enable R005)
Reference: #11864 (fix and enable R006)
Reference: #12083 (fix and enable R007, R008)
Reference: #9955 (fix and enable S006)
Reference: #9956 (fix and enable S018)
Reference: #11865 (fix and enable S020)
Reference: #11866 (fix and enable S022)
Reference: #11867 (fix and enable S023)
Reference: #11868 (fix and enable S024)
Reference: #11869 (fix and enable S031)
Reference: #11870 (fix and enable S032)
Reference: #11871 (fix and enable S033)
Reference: #11872 (fix and enable V001)
Reference: #11844 (fix and enable V002, V004, V005, V007, V008)
@gdavison gdavison added this to the v2.67.0 milestone Jun 16, 2020
@ghost
Copy link

ghost commented Jun 19, 2020

This has been released in version 2.67.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 Jul 17, 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 Jul 17, 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. technical-debt Addresses areas of the codebase that need refactoring or redesign.
Projects
None yet
3 participants