Skip to content

Commit

Permalink
provider: Fix and enable tfproviderlint S031, S032, and S033 (#12234)
Browse files Browse the repository at this point in the history
Reference: #12087
Reference: #11869 (fix and enable S031)
Reference: #11870 (fix and enable S032)
Reference: #11871 (fix and enable S033)

Previously:

```
aws/data_source_aws_cloudhsm2_cluster.go:38:28: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_dynamodb_table.go:149:11: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_dynamodb_table.go:192:30: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_efs_file_system.go:62:24: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_eks_cluster.go:23:29: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_eks_cluster.go:89:18: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_elastic_beanstalk_application.go:29:28: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_elb.go:27:19: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_elb.go:80:20: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lambda_function.go:130:19: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lambda_function.go:144:22: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lambda_function.go:31:26: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lambda_function.go:49:14: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lambda_function.go:81:18: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lambda_layer_version.go:34:27: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lb.go:74:19: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lb_target_group.go:73:18: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_lb_target_group.go:95:20: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_mq_broker.go:131:37: S031: schema should not only enable Computed and configure MaxItems
aws/data_source_aws_mq_broker.go:37:21: S031: schema should not only enable Computed and configure MaxItems
aws/resource_aws_api_gateway_account.go:29:25: S031: schema should not only enable Computed and configure MaxItems
aws/resource_aws_cloudhsm2_cluster.go:64:28: S031: schema should not only enable Computed and configure MaxItems
aws/resource_aws_eks_cluster.go:47:29: S031: schema should not only enable Computed and configure MaxItems

aws/data_source_aws_lambda_function.go:31:26: S032: schema should not only enable Computed and configure MinItems

aws/data_source_aws_cloudformation_stack.go:22:21: S033: schema should not only enable Computed and configure StateFunc
aws/data_source_aws_dynamodb_table.go:140:24: S033: schema should not only enable Computed and configure StateFunc
aws/data_source_aws_rds_cluster.go:120:36: S033: schema should not only enable Computed and configure StateFunc
```

Output from acceptance testing:

```
--- PASS: TestAccAWSAPIGatewayAccount_basic (116.01s)

--- PASS: TestAccAWSCloudFormationStack_dataSource_basic (74.98s)
--- PASS: TestAccAWSCloudFormationStack_dataSource_yaml (74.96s)

--- PASS: TestAccAWSCloudHsm2Cluster_basic (292.57s)
--- PASS: TestAccAWSCloudHsm2Cluster_Tags (340.49s)

--- PASS: TestAccAWSEksCluster_basic (1204.53s)
--- PASS: TestAccAWSEksCluster_Logging (1300.14s)
--- PASS: TestAccAWSEksCluster_Tags (1280.00s)
--- PASS: TestAccAWSEksCluster_Version (2452.84s)
--- PASS: TestAccAWSEksCluster_VpcConfig_EndpointPrivateAccess (2435.44s)
--- PASS: TestAccAWSEksCluster_VpcConfig_EndpointPublicAccess (1720.71s)
--- PASS: TestAccAWSEksCluster_VpcConfig_PublicAccessCidrs (1587.49s)
--- PASS: TestAccAWSEksCluster_VpcConfig_SecurityGroupIds (1186.78s)
--- PASS: TestAccAWSEksClusterDataSource_basic (1239.69s)

--- PASS: TestAccAwsElasticBeanstalkApplicationDataSource_basic (21.56s)

--- PASS: TestAccDataSourceAWSALBTargetGroup_basic (175.08s)

--- PASS: TestAccDataSourceAwsDynamoDbTable_basic (44.81s)

--- PASS: TestAccDataSourceAwsEfsFileSystem_id (29.06s)
--- PASS: TestAccDataSourceAwsEfsFileSystem_name (28.39s)

--- PASS: TestAccDataSourceAWSELB_basic (53.87s)

--- PASS: TestAccDataSourceAWSLambdaFunction_alias (65.51s)
--- PASS: TestAccDataSourceAWSLambdaFunction_basic (49.09s)
--- PASS: TestAccDataSourceAWSLambdaFunction_environment (59.75s)
--- PASS: TestAccDataSourceAWSLambdaFunction_layers (71.91s)
--- PASS: TestAccDataSourceAWSLambdaFunction_version (41.88s)
--- PASS: TestAccDataSourceAWSLambdaFunction_vpc (1838.06s)
--- PASS: TestAccDataSourceAWSLambdaLayerVersion_basic (19.83s)
--- PASS: TestAccDataSourceAWSLambdaLayerVersion_runtime (46.22s)
--- PASS: TestAccDataSourceAWSLambdaLayerVersion_version (35.61s)

--- PASS: TestAccDataSourceAWSLB_basic (211.76s)

--- PASS: TestAccDataSourceAWSMqBroker_basic (1232.73s)

--- PASS: TestAccDataSourceAWSRDSCluster_basic (135.85s)

--- PASS: TestAccDataSourceCloudHsm2Cluster_basic (267.05s)
```
  • Loading branch information
bflad authored Mar 10, 2020
1 parent a19aa73 commit e6489e6
Show file tree
Hide file tree
Showing 17 changed files with 3 additions and 40 deletions.
3 changes: 3 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ lint:
-S028 \
-S029 \
-S030 \
-S031 \
-S032 \
-S033 \
-S034 \
-V003 \
-V006 \
Expand Down
4 changes: 0 additions & 4 deletions aws/data_source_aws_cloudformation_stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ func dataSourceAwsCloudFormationStack() *schema.Resource {
"template_body": {
Type: schema.TypeString,
Computed: true,
StateFunc: func(v interface{}) string {
template, _ := normalizeCloudFormationTemplate(v)
return template
},
},
"capabilities": {
Type: schema.TypeSet,
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_cloudhsm2_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func dataSourceCloudHsm2Cluster() *schema.Resource {

"cluster_certificates": {
Type: schema.TypeList,
MaxItems: 1,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down
7 changes: 0 additions & 7 deletions aws/data_source_aws_dynamodb_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package aws
import (
"bytes"
"fmt"
"strings"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/dynamodb"
Expand Down Expand Up @@ -140,16 +139,11 @@ func dataSourceAwsDynamoDbTable() *schema.Resource {
"stream_view_type": {
Type: schema.TypeString,
Computed: true,
StateFunc: func(v interface{}) string {
value := v.(string)
return strings.ToUpper(value)
},
},
"tags": tagsSchemaComputed(),
"ttl": {
Type: schema.TypeSet,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"attribute_name": {
Expand Down Expand Up @@ -192,7 +186,6 @@ func dataSourceAwsDynamoDbTable() *schema.Resource {
"point_in_time_recovery": {
Type: schema.TypeList,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"enabled": {
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_efs_file_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ func dataSourceAwsEfsFileSystem() *schema.Resource {
"lifecycle_policy": {
Type: schema.TypeList,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"transition_to_ia": {
Expand Down
2 changes: 0 additions & 2 deletions aws/data_source_aws_eks_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ func dataSourceAwsEksCluster() *schema.Resource {
},
"certificate_authority": {
Type: schema.TypeList,
MaxItems: 1,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -88,7 +87,6 @@ func dataSourceAwsEksCluster() *schema.Resource {
"tags": tagsSchemaComputed(),
"vpc_config": {
Type: schema.TypeList,
MaxItems: 1,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_elastic_beanstalk_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ func dataSourceAwsElasticBeanstalkApplication() *schema.Resource {
"appversion_lifecycle": {
Type: schema.TypeList,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"service_role": {
Expand Down
2 changes: 0 additions & 2 deletions aws/data_source_aws_elb.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func dataSourceAwsElb() *schema.Resource {
"access_logs": {
Type: schema.TypeList,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"interval": {
Expand Down Expand Up @@ -80,7 +79,6 @@ func dataSourceAwsElb() *schema.Resource {
"health_check": {
Type: schema.TypeList,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"healthy_threshold": {
Expand Down
6 changes: 0 additions & 6 deletions aws/data_source_aws_lambda_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ func dataSourceAwsLambdaFunction() *schema.Resource {
"dead_letter_config": {
Type: schema.TypeList,
Computed: true,
MinItems: 0,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"target_arn": {
Expand All @@ -49,7 +47,6 @@ func dataSourceAwsLambdaFunction() *schema.Resource {
"layers": {
Type: schema.TypeList,
Computed: true,
MaxItems: 5,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Expand Down Expand Up @@ -81,7 +78,6 @@ func dataSourceAwsLambdaFunction() *schema.Resource {
"vpc_config": {
Type: schema.TypeList,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"subnet_ids": {
Expand Down Expand Up @@ -130,7 +126,6 @@ func dataSourceAwsLambdaFunction() *schema.Resource {
"environment": {
Type: schema.TypeList,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"variables": {
Expand All @@ -143,7 +138,6 @@ func dataSourceAwsLambdaFunction() *schema.Resource {
},
"tracing_config": {
Type: schema.TypeList,
MaxItems: 1,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_lambda_layer_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func dataSourceAwsLambdaLayerVersion() *schema.Resource {
"compatible_runtimes": {
Type: schema.TypeSet,
Computed: true,
MaxItems: 5,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Expand Down
1 change: 0 additions & 1 deletion aws/data_source_aws_lb.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ func dataSourceAwsLb() *schema.Resource {
"access_logs": {
Type: schema.TypeList,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"bucket": {
Expand Down
2 changes: 0 additions & 2 deletions aws/data_source_aws_lb_target_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func dataSourceAwsLbTargetGroup() *schema.Resource {
"stickiness": {
Type: schema.TypeList,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"enabled": {
Expand All @@ -95,7 +94,6 @@ func dataSourceAwsLbTargetGroup() *schema.Resource {
"health_check": {
Type: schema.TypeList,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"enabled": {
Expand Down
2 changes: 0 additions & 2 deletions aws/data_source_aws_mq_broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func dataSourceAwsMqBroker() *schema.Resource {
"configuration": {
Type: schema.TypeList,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Expand Down Expand Up @@ -130,7 +129,6 @@ func dataSourceAwsMqBroker() *schema.Resource {
},
"maintenance_window_start_time": {
Type: schema.TypeList,
MaxItems: 1,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down
7 changes: 0 additions & 7 deletions aws/data_source_aws_rds_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package aws
import (
"fmt"
"log"
"strings"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/rds"
Expand Down Expand Up @@ -120,12 +119,6 @@ func dataSourceAwsRdsCluster() *schema.Resource {
"preferred_maintenance_window": {
Type: schema.TypeString,
Computed: true,
StateFunc: func(val interface{}) string {
if val == nil {
return ""
}
return strings.ToLower(val.(string))
},
},

"port": {
Expand Down
1 change: 0 additions & 1 deletion aws/resource_aws_api_gateway_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ func resourceAwsApiGatewayAccount() *schema.Resource {
"throttle_settings": {
Type: schema.TypeList,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"burst_limit": {
Expand Down
1 change: 0 additions & 1 deletion aws/resource_aws_cloudhsm2_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ func resourceAwsCloudHsm2Cluster() *schema.Resource {

"cluster_certificates": {
Type: schema.TypeList,
MaxItems: 1,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down
1 change: 0 additions & 1 deletion aws/resource_aws_eks_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func resourceAwsEksCluster() *schema.Resource {
},
"certificate_authority": {
Type: schema.TypeList,
MaxItems: 1,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down

0 comments on commit e6489e6

Please sign in to comment.