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

service/ec2: Fixes for tfproviderlint R002 #11947

Merged
merged 1 commit into from
Feb 26, 2020
Merged

service/ec2: Fixes for tfproviderlint R002 #11947

merged 1 commit into from
Feb 26, 2020

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Feb 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

Reference: #9952

Release note for CHANGELOG:

NONE

Remove pointer value dereferences, which can cause potential panics and are extraneous as Set() automatically handles pointer types including when nil.

Previously:

aws/resource_aws_route_table_association.go:118:24: R002: ResourceData.Set() pointer value dereference is extraneous
aws/resource_aws_route_table_association.go:121:25: R002: ResourceData.Set() pointer value dereference is extraneous
aws/resource_aws_security_group_rule.go:762:38: R002: ResourceData.Set() pointer value dereference is extraneous
aws/resource_aws_security_group_rule.go:764:38: R002: ResourceData.Set() pointer value dereference is extraneous
aws/resource_aws_spot_instance_request.go:267:27: R002: ResourceData.Set() pointer value dereference is extraneous
aws/resource_aws_spot_instance_request.go:270:29: R002: ResourceData.Set() pointer value dereference is extraneous
aws/resource_aws_vpn_gateway.go:111:19: R002: ResourceData.Set() pointer value dereference is extraneous
aws/resource_aws_vpn_gateway_attachment.go:109:18: R002: ResourceData.Set() pointer value dereference is extraneous

Output from acceptance testing:

--- PASS: TestAccAWSRouteTableAssociation_disappears (45.48s)
--- PASS: TestAccAWSRouteTableAssociation_Gateway_basic (49.52s)
--- PASS: TestAccAWSRouteTableAssociation_Subnet_basic (50.05s)
--- PASS: TestAccAWSRouteTableAssociation_Subnet_ChangeSubnet (66.29s)
--- PASS: TestAccAWSRouteTableAssociation_Subnet_ChangeRouteTable (68.18s)
--- PASS: TestAccAWSRouteTableAssociation_Gateway_ChangeRouteTable (72.08s)
--- PASS: TestAccAWSRouteTableAssociation_Gateway_ChangeGateway (84.97s)

--- PASS: TestAccAWSSecurityGroupRule_ExpectInvalidTypeError (2.06s)
--- PASS: TestAccAWSSecurityGroupRule_ExpectInvalidCIDR (2.32s)
--- PASS: TestAccAWSSecurityGroupRule_Ingress_VPC (24.60s)
--- PASS: TestAccAWSSecurityGroupRule_EgressDescription (25.25s)
--- PASS: TestAccAWSSecurityGroupRule_Ingress_Classic (25.41s)
--- PASS: TestAccAWSSecurityGroupRule_Issue5310 (26.12s)
--- PASS: TestAccAWSSecurityGroupRule_MultiIngress (26.15s)
--- PASS: TestAccAWSSecurityGroupRule_MultipleRuleSearching_AllProtocolCrash (26.33s)
--- PASS: TestAccAWSSecurityGroupRule_IngressDescription (24.08s)
--- PASS: TestAccAWSSecurityGroupRule_Egress (27.56s)
--- PASS: TestAccAWSSecurityGroupRule_EgressDescription_updates (34.23s)
--- PASS: TestAccAWSSecurityGroupRule_Description_AllPorts_NonZeroPorts (36.67s)
--- PASS: TestAccAWSSecurityGroupRule_Description_AllPorts (37.03s)
--- PASS: TestAccAWSSecurityGroupRule_IngressDescription_updates (34.98s)
--- PASS: TestAccAWSSecurityGroupRule_Ingress_Ipv6 (37.73s)
--- PASS: TestAccAWSSecurityGroupRule_SelfSource (38.09s)
--- PASS: TestAccAWSSecurityGroupRule_SelfReference (38.82s)
--- PASS: TestAccAWSSecurityGroupRule_Ingress_Protocol (39.77s)
--- PASS: TestAccAWSSecurityGroupRule_PartialMatching_Source (41.93s)
--- PASS: TestAccAWSSecurityGroupRule_PartialMatching_basic (46.51s)
--- PASS: TestAccAWSSecurityGroupRule_PrefixListEgress (46.06s)
--- PASS: TestAccAWSSecurityGroupRule_MultiDescription (90.18s)
--- PASS: TestAccAWSSecurityGroupRule_Race (258.80s)

--- PASS: TestAccAWSSpotInstanceRequest_withLaunchGroup (83.19s)
--- PASS: TestAccAWSSpotInstanceRequest_basic (83.78s)
--- PASS: TestAccAWSSpotInstanceRequest_vpc (102.73s)
--- PASS: TestAccAWSSpotInstanceRequest_withBlockDuration (104.39s)
--- PASS: TestAccAWSSpotInstanceRequest_withoutSpotPrice (104.43s)
--- PASS: TestAccAWSSpotInstanceRequest_validUntil (115.07s)
--- PASS: TestAccAWSSpotInstanceRequest_SubnetAndSGAndPublicIpAddress (125.03s)
--- PASS: TestAccAWSSpotInstanceRequest_NetworkInterfaceAttributes (136.48s)
--- PASS: TestAccAWSSpotInstanceRequest_getPasswordData (266.98s)

--- PASS: TestAccAWSVpnGateway_disappears (45.89s)
--- PASS: TestAccAWSVpnGateway_withAmazonSideAsnSetToState (48.07s)
--- PASS: TestAccAWSVpnGateway_withAvailabilityZoneSetToState (57.53s)
--- PASS: TestAccAWSVpnGateway_tags (66.51s)
--- PASS: TestAccAWSVpnGateway_delete (73.68s)
--- PASS: TestAccAWSVpnGateway_basic (97.77s)
--- PASS: TestAccAWSVpnGateway_reattach (137.08s)

--- PASS: TestAccAWSVpnGatewayAttachment_basic (51.22s)
--- PASS: TestAccAWSVpnGatewayAttachment_deleted (67.20s)

Reference: #9952

Remove pointer value dereferences, which can cause potential panics and are extraneous as `Set()` automatically handles pointer types including when `nil`.

Previously:

```
aws/resource_aws_route_table_association.go:118:24: R002: ResourceData.Set() pointer value dereference is extraneous
aws/resource_aws_route_table_association.go:121:25: R002: ResourceData.Set() pointer value dereference is extraneous
aws/resource_aws_security_group_rule.go:762:38: R002: ResourceData.Set() pointer value dereference is extraneous
aws/resource_aws_security_group_rule.go:764:38: R002: ResourceData.Set() pointer value dereference is extraneous
aws/resource_aws_spot_instance_request.go:267:27: R002: ResourceData.Set() pointer value dereference is extraneous
aws/resource_aws_spot_instance_request.go:270:29: R002: ResourceData.Set() pointer value dereference is extraneous
aws/resource_aws_vpn_gateway.go:111:19: R002: ResourceData.Set() pointer value dereference is extraneous
aws/resource_aws_vpn_gateway_attachment.go:109:18: R002: ResourceData.Set() pointer value dereference is extraneous
```

Output from acceptance testing:

```
--- PASS: TestAccAWSRouteTableAssociation_disappears (45.48s)
--- PASS: TestAccAWSRouteTableAssociation_Gateway_basic (49.52s)
--- PASS: TestAccAWSRouteTableAssociation_Subnet_basic (50.05s)
--- PASS: TestAccAWSRouteTableAssociation_Subnet_ChangeSubnet (66.29s)
--- PASS: TestAccAWSRouteTableAssociation_Subnet_ChangeRouteTable (68.18s)
--- PASS: TestAccAWSRouteTableAssociation_Gateway_ChangeRouteTable (72.08s)
--- PASS: TestAccAWSRouteTableAssociation_Gateway_ChangeGateway (84.97s)

--- PASS: TestAccAWSSecurityGroupRule_ExpectInvalidTypeError (2.06s)
--- PASS: TestAccAWSSecurityGroupRule_ExpectInvalidCIDR (2.32s)
--- PASS: TestAccAWSSecurityGroupRule_Ingress_VPC (24.60s)
--- PASS: TestAccAWSSecurityGroupRule_EgressDescription (25.25s)
--- PASS: TestAccAWSSecurityGroupRule_Ingress_Classic (25.41s)
--- PASS: TestAccAWSSecurityGroupRule_Issue5310 (26.12s)
--- PASS: TestAccAWSSecurityGroupRule_MultiIngress (26.15s)
--- PASS: TestAccAWSSecurityGroupRule_MultipleRuleSearching_AllProtocolCrash (26.33s)
--- PASS: TestAccAWSSecurityGroupRule_IngressDescription (24.08s)
--- PASS: TestAccAWSSecurityGroupRule_Egress (27.56s)
--- PASS: TestAccAWSSecurityGroupRule_EgressDescription_updates (34.23s)
--- PASS: TestAccAWSSecurityGroupRule_Description_AllPorts_NonZeroPorts (36.67s)
--- PASS: TestAccAWSSecurityGroupRule_Description_AllPorts (37.03s)
--- PASS: TestAccAWSSecurityGroupRule_IngressDescription_updates (34.98s)
--- PASS: TestAccAWSSecurityGroupRule_Ingress_Ipv6 (37.73s)
--- PASS: TestAccAWSSecurityGroupRule_SelfSource (38.09s)
--- PASS: TestAccAWSSecurityGroupRule_SelfReference (38.82s)
--- PASS: TestAccAWSSecurityGroupRule_Ingress_Protocol (39.77s)
--- PASS: TestAccAWSSecurityGroupRule_PartialMatching_Source (41.93s)
--- PASS: TestAccAWSSecurityGroupRule_PartialMatching_basic (46.51s)
--- PASS: TestAccAWSSecurityGroupRule_PrefixListEgress (46.06s)
--- PASS: TestAccAWSSecurityGroupRule_MultiDescription (90.18s)
--- PASS: TestAccAWSSecurityGroupRule_Race (258.80s)

--- PASS: TestAccAWSSpotInstanceRequest_withLaunchGroup (83.19s)
--- PASS: TestAccAWSSpotInstanceRequest_basic (83.78s)
--- PASS: TestAccAWSSpotInstanceRequest_vpc (102.73s)
--- PASS: TestAccAWSSpotInstanceRequest_withBlockDuration (104.39s)
--- PASS: TestAccAWSSpotInstanceRequest_withoutSpotPrice (104.43s)
--- PASS: TestAccAWSSpotInstanceRequest_validUntil (115.07s)
--- PASS: TestAccAWSSpotInstanceRequest_SubnetAndSGAndPublicIpAddress (125.03s)
--- PASS: TestAccAWSSpotInstanceRequest_NetworkInterfaceAttributes (136.48s)
--- PASS: TestAccAWSSpotInstanceRequest_getPasswordData (266.98s)

--- PASS: TestAccAWSVpnGateway_disappears (45.89s)
--- PASS: TestAccAWSVpnGateway_withAmazonSideAsnSetToState (48.07s)
--- PASS: TestAccAWSVpnGateway_withAvailabilityZoneSetToState (57.53s)
--- PASS: TestAccAWSVpnGateway_tags (66.51s)
--- PASS: TestAccAWSVpnGateway_delete (73.68s)
--- PASS: TestAccAWSVpnGateway_basic (97.77s)
--- PASS: TestAccAWSVpnGateway_reattach (137.08s)

--- PASS: TestAccAWSVpnGatewayAttachment_basic (51.22s)
--- PASS: TestAccAWSVpnGatewayAttachment_deleted (67.20s)
```
@bflad bflad added the technical-debt Addresses areas of the codebase that need refactoring or redesign. label Feb 6, 2020
@bflad bflad requested a review from a team February 6, 2020 22:22
@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. service/ec2 Issues and PRs that pertain to the ec2 service. labels Feb 6, 2020
@bflad bflad removed the needs-triage Waiting for first response or review from a maintainer. label Feb 6, 2020
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: TestIpPermissionIDHash (0.00s)
--- PASS: TestAccAWSSecurityGroupRule_ExpectInvalidTypeError (4.33s)
--- PASS: TestAccAWSSecurityGroupRule_ExpectInvalidCIDR (6.95s)
--- PASS: TestAccAWSSecurityGroupRule_Egress (29.91s)
--- PASS: TestAccAWSSecurityGroupRule_Ingress_Classic (32.31s)
--- PASS: TestAccAWSSecurityGroupRule_SelfSource (27.67s)
--- PASS: TestAccAWSSecurityGroupRule_SelfReference (35.33s)
--- PASS: TestAccAWSSecurityGroupRule_Ingress_VPC (36.25s)
--- PASS: TestAccAWSSecurityGroupRule_MultiIngress (45.03s)
--- PASS: TestAccAWSSecurityGroupRule_PartialMatching_Source (45.58s)
--- PASS: TestAccAWSSecurityGroupRule_Ingress_Ipv6 (46.81s)
--- PASS: TestAccAWSSecurityGroupRule_Ingress_Protocol (50.13s)
--- PASS: TestAccAWSSecurityGroupRule_IngressDescription (22.41s)
--- PASS: TestAccAWSSecurityGroupRule_PartialMatching_basic (54.25s)
--- PASS: TestAccAWSRouteTableAssociation_Subnet_ChangeSubnet (55.58s)
--- PASS: TestAccAWSRouteTableAssociation_Subnet_ChangeRouteTable (56.07s)
--- PASS: TestAccAWSSecurityGroupRule_EgressDescription (25.50s)
--- PASS: TestAccAWSSecurityGroupRule_MultipleRuleSearching_AllProtocolCrash (12.38s)
--- PASS: TestAccAWSSecurityGroupRule_IngressDescription_updates (28.64s)
--- PASS: TestAccAWSSecurityGroupRule_Issue5310 (62.27s)
--- PASS: TestAccAWSRouteTableAssociation_Subnet_basic (63.61s)
--- PASS: TestAccAWSSecurityGroupRule_PrefixListEgress (57.66s)
--- PASS: TestAccAWSRouteTableAssociation_disappears (65.25s)
--- PASS: TestAccAWSSecurityGroupRule_EgressDescription_updates (34.58s)
--- PASS: TestAccAWSSecurityGroupRule_Description_AllPorts (34.16s)
--- PASS: TestAccAWSRouteTableAssociation_Gateway_basic (70.83s)
--- PASS: TestAccAWSSecurityGroupRule_Description_AllPorts_NonZeroPorts (36.16s)
--- PASS: TestAccAWSVpnGatewayAttachment_basic (39.74s)
--- PASS: TestAccAWSRouteTableAssociation_Gateway_ChangeGateway (107.06s)
--- PASS: TestAccAWSVpnGateway_withAvailabilityZoneSetToState (39.73s)
--- PASS: TestAccAWSVpnGateway_withAmazonSideAsnSetToState (32.33s)
--- PASS: TestAccAWSRouteTableAssociation_Gateway_ChangeRouteTable (117.18s)
--- PASS: TestAccAWSSecurityGroupRule_MultiDescription (82.38s)
--- PASS: TestAccAWSVpnGateway_disappears (27.47s)
--- PASS: TestAccAWSVpnGateway_basic (69.74s)
--- PASS: TestAccAWSVpnGatewayAttachment_deleted (72.40s)
--- PASS: TestAccAWSVpnGateway_delete (39.20s)
--- PASS: TestAccAWSVpnGateway_tags (38.70s)
--- PASS: TestAccAWSSpotInstanceRequest_basic (106.11s)
--- PASS: TestAccAWSSecurityGroupRule_Race (159.68s)
--- PASS: TestAccAWSSpotInstanceRequest_vpc (121.96s)
--- PASS: TestAccAWSSpotInstanceRequest_SubnetAndSGAndPublicIpAddress (121.61s)
--- PASS: TestAccAWSVpnGateway_reattach (76.71s)
--- PASS: TestAccAWSSpotInstanceRequest_withoutSpotPrice (138.88s)
--- PASS: TestAccAWSSpotInstanceRequest_withBlockDuration (142.58s)
--- PASS: TestAccAWSSpotInstanceRequest_validUntil (142.63s)
--- PASS: TestAccAWSSpotInstanceRequest_NetworkInterfaceAttributes (140.92s)
--- PASS: TestAccAWSSpotInstanceRequest_withLaunchGroup (156.65s)
--- PASS: TestAccAWSSpotInstanceRequest_getPasswordData (286.78s)
--- PASS: TestAccAWSSpotInstanceRequestInterruptStop (297.64s)
--- PASS: TestAccAWSSpotInstanceRequestInterruptHibernate (315.31s)

@bflad bflad added this to the v2.51.0 milestone Feb 26, 2020
@bflad bflad merged commit e9b8374 into master Feb 26, 2020
@bflad bflad deleted the td-ec2-R002 branch February 26, 2020 00:20
@ghost
Copy link

ghost commented Feb 28, 2020

This has been released in version 2.51.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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/ec2 Issues and PRs that pertain to the ec2 service. size/XS Managed by automation to categorize the size of a PR. technical-debt Addresses areas of the codebase that need refactoring or redesign.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants