Skip to content

Commit 62abb9c

Browse files
committed
fix issues reported by linters
1 parent 96b76f4 commit 62abb9c

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

internal/service/ec2/vpc_nat_gateway.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -457,14 +457,8 @@ func resourceNATGatewayUpdate(ctx context.Context, d *schema.ResourceData, meta
457457
return sdkdiag.AppendErrorf(diags, "retrieving availability zone ID to name map: %s", err)
458458
}
459459

460-
oldMap, err := processAZAddressSet(d.GetRawState(), azIDtoNameMap)
461-
if err != nil {
462-
return sdkdiag.AppendErrorf(diags, "processing old availability_zone_address set: %s", err)
463-
}
464-
newMap, err := processAZAddressSet(d.GetRawConfig(), azIDtoNameMap)
465-
if err != nil {
466-
return sdkdiag.AppendErrorf(diags, "processing new availability_zone_address set: %s", err)
467-
}
460+
oldMap := processAZAddressSet(d.GetRawState(), azIDtoNameMap)
461+
newMap := processAZAddressSet(d.GetRawConfig(), azIDtoNameMap)
468462

469463
// Collect all unique AZ keys
470464
allKeys := make(map[string]bool)
@@ -644,7 +638,7 @@ func expandNATGatewayAvailabilityZoneAddresses(vs []any, d *schema.ResourceData)
644638
}
645639
}
646640

647-
if v := d.GetRawConfig().GetAttr("availability_zone_address").AsValueSlice()[index].GetAttr("availability_zone"); v.IsKnown() && !v.IsNull() {
641+
if v := d.GetRawConfig().GetAttr("availability_zone_address").AsValueSlice()[index].GetAttr(names.AttrAvailabilityZone); v.IsKnown() && !v.IsNull() {
648642
address.AvailabilityZone = aws.String(m[names.AttrAvailabilityZone].(string))
649643
} else if v := d.GetRawConfig().GetAttr("availability_zone_address").AsValueSlice()[index].GetAttr("availability_zone_id"); v.IsKnown() && !v.IsNull() {
650644
address.AvailabilityZoneId = aws.String(m["availability_zone_id"].(string))
@@ -752,7 +746,7 @@ func retrieveAZListFromRawAttr(raw cty.Value, azIDtoNameMap map[string]string) (
752746
return azList, nil
753747
}
754748

755-
func processAZAddressSet(raw cty.Value, azIDtoNameMap map[string]string) (map[string]*schema.Set, error) {
749+
func processAZAddressSet(raw cty.Value, azIDtoNameMap map[string]string) map[string]*schema.Set {
756750
availabilityZoneAddressLen := len(raw.GetAttr("availability_zone_address").AsValueSlice())
757751
result := make(map[string]*schema.Set)
758752
for i := 0; i < availabilityZoneAddressLen; i++ {
@@ -780,7 +774,7 @@ func processAZAddressSet(raw cty.Value, azIDtoNameMap map[string]string) (map[st
780774
result[az] = schema.NewSet(schema.HashString, ids)
781775
}
782776
}
783-
return result, nil
777+
return result
784778
}
785779

786780
// Associates allocation IDs to a regional NAT Gateway for a specific availability zone

internal/service/ec2/vpc_nat_gateway_data_source.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ func dataSourceNATGatewayRead(ctx context.Context, d *schema.ResourceData, meta
249249
return sdkdiag.AppendErrorf(diags, "setting regional_nat_gateway_address: %s", err)
250250
}
251251
d.Set("route_table_id", ngw.RouteTableId)
252-
253252
}
254253

255254
if err := d.Set(names.AttrTags, keyValueTags(ctx, ngw.Tags).IgnoreAWS().IgnoreConfig(ignoreTagsConfig).Map()); err != nil {

internal/service/ec2/vpc_nat_gateway_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,8 @@ func TestAccVPCNATGateway_availabilityModeRegionalAuto(t *testing.T) {
597597
Check: resource.ComposeAggregateTestCheckFunc(
598598
testAccCheckNATGatewayExists(ctx, resourceName, &natGateway),
599599
resource.TestCheckResourceAttr(resourceName, "availability_mode", string(awstypes.AvailabilityModeRegional)),
600-
resource.TestCheckResourceAttr(resourceName, "auto_provision_zones", "enabled"),
601-
resource.TestCheckResourceAttr(resourceName, "auto_scaling_ips", "enabled"),
600+
resource.TestCheckResourceAttr(resourceName, "auto_provision_zones", names.AttrEnabled),
601+
resource.TestCheckResourceAttr(resourceName, "auto_scaling_ips", names.AttrEnabled),
602602
resource.TestCheckResourceAttrSet(resourceName, "route_table_id"),
603603
),
604604
},

0 commit comments

Comments
 (0)