Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
provider: Convert and enforce most data sources to AWS Go SDK pointer…
… conversion functions during conditionals Reference: #12992 This work is being done in chunks to reduce review burden. Avoiding `aws_route` and `aws_route_table` data sources due to large pull requests pending review. Previously: ``` aws/data_source_aws_acm_certificate.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 86: if *cert.DomainName == target { -------------------------------------------------------------------------------- 128: if *certificate.Type == *certType { -------------------------------------------------------------------------------- 188: if *i.Status != *j.Status { -------------------------------------------------------------------------------- 192: if *i.Status == acm.CertificateStatusIssued { aws/data_source_aws_ami_ids.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 85: if image.Name == nil || *image.Name == "" { aws/data_source_aws_api_gateway_rest_api.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 151: if *item.Path == "/" { aws/data_source_aws_cloudfront_cache_policy.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 176: if *policySummary.CachePolicy.CachePolicyConfig.Name == d.Get("name").(string) { aws/data_source_aws_cloudfront_origin_request_policy.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 151: if *policySummary.OriginRequestPolicy.OriginRequestPolicyConfig.Name == d.Get("name").(string) { aws/data_source_aws_ebs_default_kms_key_test.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 47: if attr != *actual.KmsKeyId { aws/data_source_aws_ebs_encryption_by_default_test.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 48: if attr != *actual.EbsEncryptionByDefault { aws/data_source_aws_elasticache_cluster.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 190: if *cluster.NotificationConfiguration.TopicStatus == "active" { aws/data_source_aws_iam_server_certificate_test.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 32: if *certs[0].ServerCertificateName != "latest" { aws/data_source_aws_instance.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 391: if instance.State != nil && *instance.State.Name != "terminated" { -------------------------------------------------------------------------------- 478: if *ni.Attachment.DeviceIndex == 0 { -------------------------------------------------------------------------------- 500: if instance.SubnetId != nil && *instance.SubnetId != "" { aws/data_source_aws_kms_alias.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 46: if *entity.AliasName == target { aws/data_source_aws_lb_listener.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 286: if *listener.Port == int64(port.(int)) { aws/data_source_aws_nat_gateway.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 133: if *address.AllocationId != "" { aws/data_source_aws_sfn_state_machine.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 55: if *sm.Name == target { aws/data_source_aws_ssm_patch_baseline.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 85: if v.(string) == *baseline.OperatingSystem { aws/data_source_aws_subnet.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 178: if *a.Ipv6CidrBlockState.State == "associated" { //we can only ever have 1 IPv6 block associated at once aws/data_source_aws_workspaces_image_test.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 70: if *resp.Images[0].ImageId != rs.Primary.ID { ``` Output from acceptance testing: ``` --- FAIL: TestAccAWSAcmCertificateDataSource_multipleIssued (2.76s) # #17404 --- FAIL: TestAccAWSAcmCertificateDataSource_singleIssued (9.02s) # #17404 --- PASS: TestAccAWSAcmCertificateDataSource_KeyTypes (22.58s) --- PASS: TestAccAWSAcmCertificateDataSource_noMatchReturnsError (14.61s) --- PASS: TestAccAWSCloudFrontDataSourceCachePolicy_basic (20.71s) --- PASS: TestAccAWSCloudFrontDataSourceOriginRequestPolicy_basic (18.62s) --- PASS: TestAccAWSDataElasticacheCluster_basic (690.01s) --- PASS: TestAccAWSInstanceDataSource_AzUserData (89.39s) --- PASS: TestAccAWSInstanceDataSource_basic (105.68s) --- PASS: TestAccAWSInstanceDataSource_blockDevices (109.08s) --- PASS: TestAccAWSInstanceDataSource_blockDeviceTags (111.04s) --- PASS: TestAccAWSInstanceDataSource_creditSpecification (92.40s) --- PASS: TestAccAWSInstanceDataSource_EbsBlockDevice_KmsKeyId (111.12s) --- PASS: TestAccAWSInstanceDataSource_enclaveOptions (119.23s) --- PASS: TestAccAWSInstanceDataSource_getPasswordData_falseToTrue (169.44s) --- PASS: TestAccAWSInstanceDataSource_getPasswordData_trueToFalse (200.88s) --- PASS: TestAccAWSInstanceDataSource_GetUserData (178.11s) --- PASS: TestAccAWSInstanceDataSource_GetUserData_NoUserData (174.80s) --- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (100.39s) --- PASS: TestAccAWSInstanceDataSource_gp3ThroughputDevice (87.80s) --- PASS: TestAccAWSInstanceDataSource_keyPair (89.11s) --- PASS: TestAccAWSInstanceDataSource_metadataOptions (130.64s) --- PASS: TestAccAWSInstanceDataSource_PlacementGroup (82.19s) --- PASS: TestAccAWSInstanceDataSource_privateIP (92.96s) --- PASS: TestAccAWSInstanceDataSource_RootBlockDevice_KmsKeyId (135.66s) --- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (90.25s) --- PASS: TestAccAWSInstanceDataSource_secondaryPrivateIPs (93.10s) --- PASS: TestAccAWSInstanceDataSource_SecurityGroups (103.29s) --- PASS: TestAccAWSInstanceDataSource_tags (98.98s) --- PASS: TestAccAWSInstanceDataSource_VPC (109.26s) --- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (105.95s) --- PASS: TestAccAWSSsmPatchBaselineDataSource_existingBaseline (19.45s) --- PASS: TestAccAWSSsmPatchBaselineDataSource_newBaseline (22.38s) --- PASS: TestAccDataSourceAwsAmiIds_basic (16.91s) --- PASS: TestAccDataSourceAwsAmiIds_sorted (37.67s) --- PASS: TestAccDataSourceAwsApiGatewayRestApi_basic (16.62s) --- PASS: TestAccDataSourceAwsApiGatewayRestApi_EndpointConfiguration_VpcEndpointIds (200.16s) --- PASS: TestAccDataSourceAwsEBSDefaultKmsKey_basic (19.55s) --- PASS: TestAccDataSourceAwsEBSEncryptionByDefault_basic (10.56s) --- PASS: TestAccDataSourceAwsKmsAlias_AwsService (12.84s) --- PASS: TestAccDataSourceAwsKmsAlias_CMK (19.43s) --- PASS: TestAccDataSourceAWSLBListener_BackwardsCompatibility (196.24s) --- PASS: TestAccDataSourceAWSLBListener_basic (186.19s) --- PASS: TestAccDataSourceAWSLBListener_DefaultAction_Forward (183.04s) --- PASS: TestAccDataSourceAWSLBListener_https (187.24s) --- PASS: TestAccDataSourceAwsNatGateway_basic (208.03s) --- PASS: TestAccDataSourceAwsSfnStateMachine_basic (49.83s) --- PASS: TestAccDataSourceAwsSubnet_basic (34.58s) --- PASS: TestAccDataSourceAwsSubnet_ipv6ByIpv6CidrBlock (58.30s) --- PASS: TestAccDataSourceAwsSubnet_ipv6ByIpv6Filter (85.44s) --- SKIP: TestAccDataSourceAwsWorkspacesImage_basic (0.76s) ```
- Loading branch information