Skip to content

Commit

Permalink
resource/aws_opsworks_stack: Fixes for tfproviderlint R002 (#12028)
Browse files Browse the repository at this point in the history
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_opsworks_stack.go:328:38: R002: ResourceData.Set() pointer value dereference is extraneous
```

Output from acceptance testing:

```
--- PASS: TestAccAWSOpsworksStack_noVpcBasic (36.09s)
--- PASS: TestAccAWSOpsworksStack_noVpcCreateTags (46.83s)
--- PASS: TestAccAWSOpsworksStack_CustomCookbooks_SetPrivateProperties (40.27s)
--- PASS: TestAccAWSOpsworksStack_vpc (64.43s)
--- PASS: TestAccAWSOpsworksStack_noVpcChangeServiceRoleForceNew (43.03s)
```
  • Loading branch information
bflad authored Mar 10, 2020
1 parent fe8d04c commit 4d9ad56
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions aws/resource_aws_opsworks_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ func resourceAwsOpsworksStackRead(d *schema.ResourceData, meta interface{}) erro
return dErr
}
// If the stack was found, set the stack_endpoint
if client.Config.Region != nil && *client.Config.Region != "" {
log.Printf("[DEBUG] Setting stack_endpoint for (%s) to (%s)", d.Id(), *client.Config.Region)
if err := d.Set("stack_endpoint", *client.Config.Region); err != nil {
if region := aws.StringValue(client.Config.Region); region != "" {
log.Printf("[DEBUG] Setting stack_endpoint for (%s) to (%s)", d.Id(), region)
if err := d.Set("stack_endpoint", region); err != nil {
log.Printf("[WARN] Error setting stack_endpoint: %s", err)
}
}
Expand Down

0 comments on commit 4d9ad56

Please sign in to comment.