Skip to content

Commit

Permalink
provider: First batch of unparam linter fixes (hashicorp#13279)
Browse files Browse the repository at this point in the history
* provider: First batch of unparam linter fixes

Reference: hashicorp#13278

Previously:

```
aws/resource_aws_api_gateway_base_path_mapping_test.go:124:56: `testAccCheckAWSAPIGatewayBasePathExists` - `name` is unused (unparam)
func testAccCheckAWSAPIGatewayBasePathExists(n string, name string, res *apigateway.BasePathMapping) resource.TestCheckFunc {
                                                       ^
aws/resource_aws_athena_database.go:67:126: expandAthenaResultConfiguration - result 1 (error) is always nil (unparam)
func expandAthenaResultConfiguration(bucket string, encryptionConfigurationList []interface{}) (*athena.ResultConfiguration, error) {
                                                                                                                             ^
aws/resource_aws_cloudtrail_test.go:552:67: `testAccCheckCloudTrailLoggingEnabled` - `trail` is unused (unparam)
func testAccCheckCloudTrailLoggingEnabled(n string, desired bool, trail *cloudtrail.Trail) resource.TestCheckFunc {
                                                                  ^
aws/resource_aws_ecs_cluster_test.go:494:58: `testAccAWSEcsClusterCapacityProvidersFargate` - `providerName` is unused (unparam)
func testAccAWSEcsClusterCapacityProvidersFargate(rName, providerName string) string {
                                                         ^
aws/resource_aws_ecs_cluster_test.go:510:62: `testAccAWSEcsClusterCapacityProvidersFargateSpot` - `providerName` is unused (unparam)
func testAccAWSEcsClusterCapacityProvidersFargateSpot(rName, providerName string) string {
                                                             ^
aws/resource_aws_ecs_cluster_test.go:526:62: `testAccAWSEcsClusterCapacityProvidersFargateBoth` - `providerName` is unused (unparam)
func testAccAWSEcsClusterCapacityProvidersFargateBoth(rName, providerName string) string {
                                                             ^
aws/resource_aws_ecs_cluster_test.go:542:68: `testAccAWSEcsClusterCapacityProvidersFargateNoStrategy` - `providerName` is unused (unparam)
func testAccAWSEcsClusterCapacityProvidersFargateNoStrategy(rName, providerName string) string {
                                                                   ^
aws/resource_aws_ecs_cluster_test.go:552:72: `testAccAWSEcsClusterCapacityProvidersFargateSpotNoStrategy` - `providerName` is unused (unparam)
func testAccAWSEcsClusterCapacityProvidersFargateSpotNoStrategy(rName, providerName string) string {
                                                                       ^
aws/resource_aws_ecs_task_definition.go:611:93: expandEcsInferenceAccelerators - result 1 (error) is always nil (unparam)
func expandEcsInferenceAccelerators(configured []interface{}) ([]*ecs.InferenceAccelerator, error) {
                                                                                            ^
aws/resource_aws_eip_association_test.go:233:61: `testAccCheckAWSEIPAssociationHasIpBasedId` - `res` is unused (unparam)
func testAccCheckAWSEIPAssociationHasIpBasedId(name string, res *ec2.Address) resource.TestCheckFunc {
                                                            ^
aws/resource_aws_inspector_resource_group_test.go:72:53: `testAccCheckAWSInspectorResourceGroupRecreated` - `t` is unused (unparam)
func testAccCheckAWSInspectorResourceGroupRecreated(t *testing.T, v1, v2 *inspector.ResourceGroup) resource.TestCheckFunc {
                                                    ^
aws/resource_aws_instance_migrate.go:79:56: writeV1BlockDevice - result 0 (error) is always nil (unparam)
	is *terraform.InstanceState, oldBd map[string]string) error {
	                                                      ^
aws/resource_aws_kinesis_analytics_application.go:1088:96: createApplicationUpdateOpts - result 1 (error) is always nil (unparam)
func createApplicationUpdateOpts(d *schema.ResourceData) (*kinesisanalytics.ApplicationUpdate, error) {
                                                                                               ^
aws/resource_aws_kinesis_video_stream_test.go:167:68: `testAccCheckKinesisVideoStreamDisappears` - `stream` is unused (unparam)
func testAccCheckKinesisVideoStreamDisappears(resourceName string, stream *kinesisvideo.StreamInfo) resource.TestCheckFunc {
                                                                   ^
aws/resource_aws_lambda_function_test.go:2375:56: `testAccAWSLambdaConfigWithDeadLetterConfigUpdated` - `funcName` is unused (unparam)
func testAccAWSLambdaConfigWithDeadLetterConfigUpdated(funcName, topic1Name, topic2Name, policyName,
                                                       ^
aws/resource_aws_lambda_permission_test.go:544:53: `testAccAWSLambdaPermissionDisappears` - `statement` is unused (unparam)
func testAccAWSLambdaPermissionDisappears(n string, statement *LambdaPolicyStatement) resource.TestCheckFunc {
                                                    ^
aws/resource_aws_lightsail_key_pair_test.go:178:63: `testAccAWSLightsailKeyPairConfig_imported` - `key` is unused (unparam)
func testAccAWSLightsailKeyPairConfig_imported(lightsailName, key string) string {
                                                              ^
aws/resource_aws_main_route_table_association_test.go:73:2: `testAccCheckMainRouteTableAssociation` - `routeTableResource` is unused (unparam)
	routeTableResource string) resource.TestCheckFunc {
	^
```

Output from acceptance testing:

```
(TestAccAWSAPIGatewayBasePathMapping_|TestAccAWSAthenaDatabase_|TestAccAWSCloudTrail/Trail/enableLogging|TestAccAWSEcsCluster_CapacityProviders|TestAccAWSEcsTaskDefinition_|TestAccAWSInspectorResourceGroup_basic|TestAccAWSKinesisAnalyticsApplication_|TestAccAWSKinesisVideoStream_disappears|TestAccAWSLambdaFunction_DeadLetterConfigUpdated|TestAccAWSLambdaPermission_disappears|TestAccAWSLightsailKeyPair_publicKey|TestAccAWSMainRouteTableAssociation_basic)

--- PASS: TestAccAWSAPIGatewayBasePathMapping_BasePath_Empty (54.58s)
--- PASS: TestAccAWSAPIGatewayBasePathMapping_basic (55.48s)

--- PASS: TestAccAWSAthenaDatabase_basic (60.51s)
--- PASS: TestAccAWSAthenaDatabase_destroyFailsIfTablesExist (73.58s)
--- PASS: TestAccAWSAthenaDatabase_encryption (71.05s)
--- PASS: TestAccAWSAthenaDatabase_forceDestroyAlwaysSucceeds (65.41s)
--- PASS: TestAccAWSAthenaDatabase_nameCantHaveUppercase (1.46s)
--- PASS: TestAccAWSAthenaDatabase_nameStartsWithUnderscore (61.23s)

--- PASS: TestAccAWSCloudTrail/Trail/enableLogging (105.77s)

--- PASS: TestAccAWSEcsCluster_CapacityProviders (48.45s)
--- PASS: TestAccAWSEcsCluster_CapacityProvidersNoStrategy (53.69s)
--- PASS: TestAccAWSEcsCluster_CapacityProvidersUpdate (81.22s)

--- PASS: TestAccAWSEcsTaskDefinition_arrays (16.36s)
--- PASS: TestAccAWSEcsTaskDefinition_basic (26.60s)
--- PASS: TestAccAWSEcsTaskDefinition_changeVolumesForcesNewResource (26.89s)
--- PASS: TestAccAWSEcsTaskDefinition_constraint (16.28s)
--- PASS: TestAccAWSEcsTaskDefinition_ExecutionRole (16.69s)
--- PASS: TestAccAWSEcsTaskDefinition_Fargate (21.81s)
--- PASS: TestAccAWSEcsTaskDefinition_Inactive (25.92s)
--- PASS: TestAccAWSEcsTaskDefinition_inferenceAccelerator (14.07s)
--- PASS: TestAccAWSEcsTaskDefinition_ProxyConfiguration (26.41s)
--- PASS: TestAccAWSEcsTaskDefinition_Tags (45.91s)
--- PASS: TestAccAWSEcsTaskDefinition_withDockerVolume (16.00s)
--- PASS: TestAccAWSEcsTaskDefinition_withDockerVolumeMinimalConfig (16.27s)
--- PASS: TestAccAWSEcsTaskDefinition_withEcsService (91.23s)
--- PASS: TestAccAWSEcsTaskDefinition_withEFSVolume (27.55s)
--- PASS: TestAccAWSEcsTaskDefinition_withEFSVolumeMinimal (27.70s)
--- PASS: TestAccAWSEcsTaskDefinition_withIPCMode (16.69s)
--- PASS: TestAccAWSEcsTaskDefinition_withNetworkMode (16.85s)
--- PASS: TestAccAWSEcsTaskDefinition_withPidMode (18.24s)
--- PASS: TestAccAWSEcsTaskDefinition_withScratchVolume (15.69s)
--- PASS: TestAccAWSEcsTaskDefinition_withTaskRoleArn (16.75s)
--- PASS: TestAccAWSEcsTaskDefinition_withTaskScopedDockerVolume (16.38s)

--- PASS: TestAccAWSInspectorResourceGroup_basic (22.88s)

--- PASS: TestAccAWSKinesisAnalyticsApplication_addCloudwatchLoggingOptions (34.01s)
--- PASS: TestAccAWSKinesisAnalyticsApplication_basic (18.73s)
--- PASS: TestAccAWSKinesisAnalyticsApplication_inputsAdd (75.84s)
--- PASS: TestAccAWSKinesisAnalyticsApplication_inputsKinesisFirehose (103.79s)
--- PASS: TestAccAWSKinesisAnalyticsApplication_inputsKinesisStream (63.12s)
--- PASS: TestAccAWSKinesisAnalyticsApplication_inputsUpdateKinesisStream (120.00s)
--- PASS: TestAccAWSKinesisAnalyticsApplication_Outputs_Lambda_Add (50.36s)
--- PASS: TestAccAWSKinesisAnalyticsApplication_Outputs_Lambda_Create (39.75s)
--- PASS: TestAccAWSKinesisAnalyticsApplication_outputsAdd (75.76s)
--- PASS: TestAccAWSKinesisAnalyticsApplication_outputsKinesisStream (62.71s)
--- PASS: TestAccAWSKinesisAnalyticsApplication_outputsMultiple (66.35s)
--- PASS: TestAccAWSKinesisAnalyticsApplication_outputsUpdateKinesisStream (123.03s)
--- PASS: TestAccAWSKinesisAnalyticsApplication_referenceDataSource (38.35s)
--- PASS: TestAccAWSKinesisAnalyticsApplication_referenceDataSourceUpdate (69.86s)
--- PASS: TestAccAWSKinesisAnalyticsApplication_tags (49.91s)
--- PASS: TestAccAWSKinesisAnalyticsApplication_update (28.74s)
--- PASS: TestAccAWSKinesisAnalyticsApplication_updateCloudwatchLoggingOptions (46.64s)
--- PASS: TestAccAWSKinesisVideoStream_disappears (95.02s)

--- PASS: TestAccAWSLambdaFunction_DeadLetterConfigUpdated (76.72s)

--- PASS: TestAccAWSLambdaPermission_disappears (100.98s)

--- PASS: TestAccAWSLightsailKeyPair_publicKey (29.88s)

--- PASS: TestAccAWSMainRouteTableAssociation_basic (69.00s)
```

* resource/aws_instance: Remove redundant return

Previously:

```
aws/resource_aws_instance_migrate.go:108:2: S1023: redundant `return` statement (gosimple)
	return
	^
```
  • Loading branch information
bflad authored and adamdecaf committed May 28, 2020
1 parent 8a4fde4 commit ddd5111
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 89 deletions.
6 changes: 3 additions & 3 deletions aws/resource_aws_api_gateway_base_path_mapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestAccAWSAPIGatewayBasePathMapping_basic(t *testing.T) {
{
Config: testAccAWSAPIGatewayBasePathConfigBasePath(name, key, certificate, "tf-acc-test"),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSAPIGatewayBasePathExists("aws_api_gateway_base_path_mapping.test", name, &conf),
testAccCheckAWSAPIGatewayBasePathExists("aws_api_gateway_base_path_mapping.test", &conf),
),
},
{
Expand Down Expand Up @@ -109,7 +109,7 @@ func TestAccAWSAPIGatewayBasePathMapping_BasePath_Empty(t *testing.T) {
{
Config: testAccAWSAPIGatewayBasePathConfigBasePath(name, key, certificate, ""),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSAPIGatewayBasePathExists("aws_api_gateway_base_path_mapping.test", name, &conf),
testAccCheckAWSAPIGatewayBasePathExists("aws_api_gateway_base_path_mapping.test", &conf),
),
},
{
Expand All @@ -121,7 +121,7 @@ func TestAccAWSAPIGatewayBasePathMapping_BasePath_Empty(t *testing.T) {
})
}

func testAccCheckAWSAPIGatewayBasePathExists(n string, name string, res *apigateway.BasePathMapping) resource.TestCheckFunc {
func testAccCheckAWSAPIGatewayBasePathExists(n string, res *apigateway.BasePathMapping) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]
if !ok {
Expand Down
27 changes: 6 additions & 21 deletions aws/resource_aws_athena_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ func resourceAwsAthenaDatabase() *schema.Resource {
}
}

func expandAthenaResultConfiguration(bucket string, encryptionConfigurationList []interface{}) (*athena.ResultConfiguration, error) {
func expandAthenaResultConfiguration(bucket string, encryptionConfigurationList []interface{}) *athena.ResultConfiguration {
resultConfig := athena.ResultConfiguration{
OutputLocation: aws.String("s3://" + bucket),
}

if len(encryptionConfigurationList) <= 0 {
return &resultConfig, nil
return &resultConfig
}

data := encryptionConfigurationList[0].(map[string]interface{})
Expand All @@ -87,20 +87,15 @@ func expandAthenaResultConfiguration(bucket string, encryptionConfigurationList

resultConfig.EncryptionConfiguration = &encryptionConfig

return &resultConfig, nil
return &resultConfig
}

func resourceAwsAthenaDatabaseCreate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).athenaconn

resultConfig, err := expandAthenaResultConfiguration(d.Get("bucket").(string), d.Get("encryption_configuration").([]interface{}))
if err != nil {
return err
}

input := &athena.StartQueryExecutionInput{
QueryString: aws.String(fmt.Sprintf("create database `%s`;", d.Get("name").(string))),
ResultConfiguration: resultConfig,
ResultConfiguration: expandAthenaResultConfiguration(d.Get("bucket").(string), d.Get("encryption_configuration").([]interface{})),
}

resp, err := conn.StartQueryExecution(input)
Expand All @@ -118,14 +113,9 @@ func resourceAwsAthenaDatabaseCreate(d *schema.ResourceData, meta interface{}) e
func resourceAwsAthenaDatabaseRead(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).athenaconn

resultConfig, err := expandAthenaResultConfiguration(d.Get("bucket").(string), d.Get("encryption_configuration").([]interface{}))
if err != nil {
return err
}

input := &athena.StartQueryExecutionInput{
QueryString: aws.String(fmt.Sprint("show databases;")),
ResultConfiguration: resultConfig,
ResultConfiguration: expandAthenaResultConfiguration(d.Get("bucket").(string), d.Get("encryption_configuration").([]interface{})),
}

resp, err := conn.StartQueryExecution(input)
Expand All @@ -146,11 +136,6 @@ func resourceAwsAthenaDatabaseUpdate(d *schema.ResourceData, meta interface{}) e
func resourceAwsAthenaDatabaseDelete(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).athenaconn

resultConfig, err := expandAthenaResultConfiguration(d.Get("bucket").(string), d.Get("encryption_configuration").([]interface{}))
if err != nil {
return err
}

name := d.Get("name").(string)

queryString := fmt.Sprintf("drop database `%s`", name)
Expand All @@ -161,7 +146,7 @@ func resourceAwsAthenaDatabaseDelete(d *schema.ResourceData, meta interface{}) e

input := &athena.StartQueryExecutionInput{
QueryString: aws.String(queryString),
ResultConfiguration: resultConfig,
ResultConfiguration: expandAthenaResultConfiguration(d.Get("bucket").(string), d.Get("encryption_configuration").([]interface{})),
}

resp, err := conn.StartQueryExecution(input)
Expand Down
8 changes: 4 additions & 4 deletions aws/resource_aws_cloudtrail_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func testAccAWSCloudTrail_enable_logging(t *testing.T) {
testAccCheckCloudTrailExists(resourceName, &trail),
// AWS will create the trail with logging turned off.
// Test that "enable_logging" default works.
testAccCheckCloudTrailLoggingEnabled(resourceName, true, &trail),
testAccCheckCloudTrailLoggingEnabled(resourceName, true),
testAccCheckCloudTrailLogValidationEnabled(resourceName, false, &trail),
testAccCheckCloudTrailKmsKeyIdEquals(resourceName, "", &trail),
),
Expand All @@ -219,7 +219,7 @@ func testAccAWSCloudTrail_enable_logging(t *testing.T) {
Config: testAccAWSCloudTrailConfigModified(cloudTrailRandInt),
Check: resource.ComposeTestCheckFunc(
testAccCheckCloudTrailExists(resourceName, &trail),
testAccCheckCloudTrailLoggingEnabled(resourceName, false, &trail),
testAccCheckCloudTrailLoggingEnabled(resourceName, false),
testAccCheckCloudTrailLogValidationEnabled(resourceName, false, &trail),
testAccCheckCloudTrailKmsKeyIdEquals(resourceName, "", &trail),
),
Expand All @@ -228,7 +228,7 @@ func testAccAWSCloudTrail_enable_logging(t *testing.T) {
Config: testAccAWSCloudTrailConfig(cloudTrailRandInt),
Check: resource.ComposeTestCheckFunc(
testAccCheckCloudTrailExists(resourceName, &trail),
testAccCheckCloudTrailLoggingEnabled(resourceName, true, &trail),
testAccCheckCloudTrailLoggingEnabled(resourceName, true),
testAccCheckCloudTrailLogValidationEnabled(resourceName, false, &trail),
testAccCheckCloudTrailKmsKeyIdEquals(resourceName, "", &trail),
),
Expand Down Expand Up @@ -549,7 +549,7 @@ func testAccCheckCloudTrailExists(n string, trail *cloudtrail.Trail) resource.Te
}
}

func testAccCheckCloudTrailLoggingEnabled(n string, desired bool, trail *cloudtrail.Trail) resource.TestCheckFunc {
func testAccCheckCloudTrailLoggingEnabled(n string, desired bool) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]
if !ok {
Expand Down
22 changes: 10 additions & 12 deletions aws/resource_aws_ecs_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ func TestAccAWSEcsCluster_CapacityProviders(t *testing.T) {
func TestAccAWSEcsCluster_CapacityProvidersUpdate(t *testing.T) {
var cluster1 ecs.Cluster
rName := acctest.RandomWithPrefix("tf-acc-test")
providerName := acctest.RandomWithPrefix("tf-acc-test")
resourceName := "aws_ecs_cluster.test"

resource.ParallelTest(t, resource.TestCase{
Expand All @@ -226,7 +225,7 @@ func TestAccAWSEcsCluster_CapacityProvidersUpdate(t *testing.T) {
CheckDestroy: testAccCheckAWSEcsClusterDestroy,
Steps: []resource.TestStep{
{
Config: testAccAWSEcsClusterCapacityProvidersFargate(rName, providerName),
Config: testAccAWSEcsClusterCapacityProvidersFargate(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSEcsClusterExists(resourceName, &cluster1),
),
Expand All @@ -238,13 +237,13 @@ func TestAccAWSEcsCluster_CapacityProvidersUpdate(t *testing.T) {
ImportStateVerify: true,
},
{
Config: testAccAWSEcsClusterCapacityProvidersFargateSpot(rName, providerName),
Config: testAccAWSEcsClusterCapacityProvidersFargateSpot(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSEcsClusterExists(resourceName, &cluster1),
),
},
{
Config: testAccAWSEcsClusterCapacityProvidersFargateBoth(rName, providerName),
Config: testAccAWSEcsClusterCapacityProvidersFargateBoth(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSEcsClusterExists(resourceName, &cluster1),
),
Expand All @@ -256,7 +255,6 @@ func TestAccAWSEcsCluster_CapacityProvidersUpdate(t *testing.T) {
func TestAccAWSEcsCluster_CapacityProvidersNoStrategy(t *testing.T) {
var cluster1 ecs.Cluster
rName := acctest.RandomWithPrefix("tf-acc-test")
providerName := acctest.RandomWithPrefix("tf-acc-test")
resourceName := "aws_ecs_cluster.test"

resource.ParallelTest(t, resource.TestCase{
Expand All @@ -265,7 +263,7 @@ func TestAccAWSEcsCluster_CapacityProvidersNoStrategy(t *testing.T) {
CheckDestroy: testAccCheckAWSEcsClusterDestroy,
Steps: []resource.TestStep{
{
Config: testAccAWSEcsClusterCapacityProvidersFargateNoStrategy(rName, providerName),
Config: testAccAWSEcsClusterCapacityProvidersFargateNoStrategy(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSEcsClusterExists(resourceName, &cluster1),
),
Expand All @@ -277,7 +275,7 @@ func TestAccAWSEcsCluster_CapacityProvidersNoStrategy(t *testing.T) {
ImportStateVerify: true,
},
{
Config: testAccAWSEcsClusterCapacityProvidersFargateSpotNoStrategy(rName, providerName),
Config: testAccAWSEcsClusterCapacityProvidersFargateSpotNoStrategy(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSEcsClusterExists(resourceName, &cluster1),
),
Expand Down Expand Up @@ -490,7 +488,7 @@ resource "aws_ecs_cluster" "test" {
`, rName)
}

func testAccAWSEcsClusterCapacityProvidersFargate(rName, providerName string) string {
func testAccAWSEcsClusterCapacityProvidersFargate(rName string) string {
return fmt.Sprintf(`
resource "aws_ecs_cluster" "test" {
name = %[1]q
Expand All @@ -506,7 +504,7 @@ resource "aws_ecs_cluster" "test" {
`, rName)
}

func testAccAWSEcsClusterCapacityProvidersFargateSpot(rName, providerName string) string {
func testAccAWSEcsClusterCapacityProvidersFargateSpot(rName string) string {
return fmt.Sprintf(`
resource "aws_ecs_cluster" "test" {
name = %[1]q
Expand All @@ -522,7 +520,7 @@ resource "aws_ecs_cluster" "test" {
`, rName)
}

func testAccAWSEcsClusterCapacityProvidersFargateBoth(rName, providerName string) string {
func testAccAWSEcsClusterCapacityProvidersFargateBoth(rName string) string {
return fmt.Sprintf(`
resource "aws_ecs_cluster" "test" {
name = %[1]q
Expand All @@ -538,7 +536,7 @@ resource "aws_ecs_cluster" "test" {
`, rName)
}

func testAccAWSEcsClusterCapacityProvidersFargateNoStrategy(rName, providerName string) string {
func testAccAWSEcsClusterCapacityProvidersFargateNoStrategy(rName string) string {
return fmt.Sprintf(`
resource "aws_ecs_cluster" "test" {
name = %[1]q
Expand All @@ -548,7 +546,7 @@ resource "aws_ecs_cluster" "test" {
`, rName)
}

func testAccAWSEcsClusterCapacityProvidersFargateSpotNoStrategy(rName, providerName string) string {
func testAccAWSEcsClusterCapacityProvidersFargateSpotNoStrategy(rName string) string {
return fmt.Sprintf(`
resource "aws_ecs_cluster" "test" {
name = %[1]q
Expand Down
10 changes: 3 additions & 7 deletions aws/resource_aws_ecs_task_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,7 @@ func resourceAwsEcsTaskDefinitionCreate(d *schema.ResourceData, meta interface{}
}

if v, ok := d.GetOk("inference_accelerator"); ok {
iAcc, err := expandEcsInferenceAccelerators(v.(*schema.Set).List())
if err != nil {
return err
}
input.InferenceAccelerators = iAcc
input.InferenceAccelerators = expandEcsInferenceAccelerators(v.(*schema.Set).List())
}

constraints := d.Get("placement_constraints").(*schema.Set).List()
Expand Down Expand Up @@ -607,7 +603,7 @@ func flattenEcsInferenceAccelerators(list []*ecs.InferenceAccelerator) []map[str
return result
}

func expandEcsInferenceAccelerators(configured []interface{}) ([]*ecs.InferenceAccelerator, error) {
func expandEcsInferenceAccelerators(configured []interface{}) []*ecs.InferenceAccelerator {
iAccs := make([]*ecs.InferenceAccelerator, 0, len(configured))
for _, lRaw := range configured {
data := lRaw.(map[string]interface{})
Expand All @@ -618,5 +614,5 @@ func expandEcsInferenceAccelerators(configured []interface{}) ([]*ecs.InferenceA
iAccs = append(iAccs, l)
}

return iAccs, nil
return iAccs
}
4 changes: 2 additions & 2 deletions aws/resource_aws_eip_association_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func TestAccAWSEIPAssociation_ec2Classic(t *testing.T) {
testAccCheckAWSEIPAssociationExists(resourceName, &a),
resource.TestCheckResourceAttrSet(resourceName, "public_ip"),
resource.TestCheckResourceAttr(resourceName, "allocation_id", ""),
testAccCheckAWSEIPAssociationHasIpBasedId(resourceName, &a),
testAccCheckAWSEIPAssociationHasIpBasedId(resourceName),
),
},
{
Expand Down Expand Up @@ -230,7 +230,7 @@ func testAccCheckAWSEIPAssociationExists(name string, res *ec2.Address) resource
}
}

func testAccCheckAWSEIPAssociationHasIpBasedId(name string, res *ec2.Address) resource.TestCheckFunc {
func testAccCheckAWSEIPAssociationHasIpBasedId(name string) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[name]
if !ok {
Expand Down
4 changes: 2 additions & 2 deletions aws/resource_aws_inspector_resource_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestAccAWSInspectorResourceGroup_basic(t *testing.T) {
testAccCheckAWSInspectorResourceGroupExists(resourceName, &v2),
testAccMatchResourceAttrRegionalARN(resourceName, "arn", "inspector", regexp.MustCompile(`resourcegroup/.+`)),
resource.TestCheckResourceAttr(resourceName, "tags.Name", "bar"),
testAccCheckAWSInspectorResourceGroupRecreated(t, &v1, &v2),
testAccCheckAWSInspectorResourceGroupRecreated(&v1, &v2),
),
},
},
Expand Down Expand Up @@ -69,7 +69,7 @@ func testAccCheckAWSInspectorResourceGroupExists(name string, rg *inspector.Reso
}
}

func testAccCheckAWSInspectorResourceGroupRecreated(t *testing.T, v1, v2 *inspector.ResourceGroup) resource.TestCheckFunc {
func testAccCheckAWSInspectorResourceGroupRecreated(v1, v2 *inspector.ResourceGroup) resource.TestCheckFunc {
return func(s *terraform.State) error {
if v2.CreatedAt.Equal(*v1.CreatedAt) {
return fmt.Errorf("Inspector resource group not recreated when changing tags")
Expand Down
7 changes: 2 additions & 5 deletions aws/resource_aws_instance_migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ func migrateAwsInstanceStateV0toV1(is *terraform.InstanceState) (*terraform.Inst
is.Attributes["root_block_device.#"] = "0"
}
for _, oldBd := range oldBds {
if err := writeV1BlockDevice(is, oldBd); err != nil {
return is, err
}
writeV1BlockDevice(is, oldBd)
}
log.Printf("[DEBUG] Attributes after migration: %#v", is.Attributes)
return is, nil
Expand Down Expand Up @@ -76,7 +74,7 @@ func readV0BlockDevices(is *terraform.InstanceState) (map[string]map[string]stri
}

func writeV1BlockDevice(
is *terraform.InstanceState, oldBd map[string]string) error {
is *terraform.InstanceState, oldBd map[string]string) {
code := hashcode.String(oldBd["device_name"])
bdType := "ebs_block_device"
if vn, ok := oldBd["virtual_name"]; ok && strings.HasPrefix(vn, "ephemeral") {
Expand Down Expand Up @@ -107,5 +105,4 @@ func writeV1BlockDevice(
countAttr := fmt.Sprintf("%s.#", bdType)
count, _ := strconv.Atoi(is.Attributes[countAttr])
is.Attributes[countAttr] = strconv.Itoa(count + 1)
return nil
}
9 changes: 3 additions & 6 deletions aws/resource_aws_kinesis_analytics_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,10 +702,7 @@ func resourceAwsKinesisAnalyticsApplicationUpdate(d *schema.ResourceData, meta i
CurrentApplicationVersionId: aws.Int64(int64(version)),
}

applicationUpdate, err := createApplicationUpdateOpts(d)
if err != nil {
return err
}
applicationUpdate := createApplicationUpdateOpts(d)

if !reflect.DeepEqual(applicationUpdate, &kinesisanalytics.ApplicationUpdate{}) {
updateApplicationOpts.SetApplicationUpdate(applicationUpdate)
Expand Down Expand Up @@ -1083,7 +1080,7 @@ func expandKinesisAnalyticsReferenceData(rd map[string]interface{}) *kinesisanal
return referenceData
}

func createApplicationUpdateOpts(d *schema.ResourceData) (*kinesisanalytics.ApplicationUpdate, error) {
func createApplicationUpdateOpts(d *schema.ResourceData) *kinesisanalytics.ApplicationUpdate {
applicationUpdate := &kinesisanalytics.ApplicationUpdate{}

if d.HasChange("code") {
Expand Down Expand Up @@ -1152,7 +1149,7 @@ func createApplicationUpdateOpts(d *schema.ResourceData) (*kinesisanalytics.Appl
}
}

return applicationUpdate, nil
return applicationUpdate
}

func expandKinesisAnalyticsInputUpdate(vL map[string]interface{}) *kinesisanalytics.InputUpdate {
Expand Down
4 changes: 2 additions & 2 deletions aws/resource_aws_kinesis_video_stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ func TestAccAWSKinesisVideoStream_disappears(t *testing.T) {
Config: testAccKinesisVideoStreamConfig(rInt),
Check: resource.ComposeTestCheckFunc(
testAccCheckKinesisVideoStreamExists(resourceName, &stream),
testAccCheckKinesisVideoStreamDisappears(resourceName, &stream),
testAccCheckKinesisVideoStreamDisappears(resourceName),
),
ExpectNonEmptyPlan: true,
},
},
})
}

func testAccCheckKinesisVideoStreamDisappears(resourceName string, stream *kinesisvideo.StreamInfo) resource.TestCheckFunc {
func testAccCheckKinesisVideoStreamDisappears(resourceName string) resource.TestCheckFunc {
return func(s *terraform.State) error {
conn := testAccProvider.Meta().(*AWSClient).kinesisvideoconn

Expand Down
Loading

0 comments on commit ddd5111

Please sign in to comment.