Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tech Debt: Remove provider "aws" blocks from non provider_test.go files #8983

Closed
16 tasks
ryndaniels opened this issue Jun 13, 2019 · 2 comments · Fixed by #16258
Closed
16 tasks

Tech Debt: Remove provider "aws" blocks from non provider_test.go files #8983

ryndaniels opened this issue Jun 13, 2019 · 2 comments · Fixed by #16258
Assignees
Labels
technical-debt Addresses areas of the codebase that need refactoring or redesign. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Milestone

Comments

@ryndaniels
Copy link
Contributor

ryndaniels commented Jun 13, 2019

Description

Provider configurations should be handled outside of individual test configurations. Having the provider configured in individual tests can lead to unexpected behavior when multiple configurations overlap or conflict with each other. This also allows the tests to be AWS Region and Partition agnostic.

Test Updates

Existing tests should be updated to remove any hardcoded provider "aws" {...} blocks from individual test configurations.

Linting

Going forward, a linter rule such as AT004 could be added to prevent these from being added in the future.

Definition of Done

  • In GNUmakefile, add -AT004 to tfproviderlint command under lint target and have TravisCI testing pass

Issues:

  • data_source_aws_cur_report_definition_test.go:63:21
  • data_source_aws_eip_test.go:221:57
  • data_source_aws_instance_test.go:779:21
  • provider_test.go:1593:54
  • resource_aws_cur_report_definition_test.go:108:21
  • resource_aws_default_security_group_test.go:169:54
  • resource_aws_eip_association_test.go:410:51
  • resource_aws_eip_test.go:697:41
  • resource_aws_elasticache_security_group_test.go:143:60
  • resource_aws_instance_test.go:3386:21
  • resource_aws_instance_test.go:3810:46
  • resource_aws_lightsail_domain_test.go:131:21
  • resource_aws_opsworks_stack_test.go:226:21
  • resource_aws_opsworks_stack_test.go:312:21
  • resource_aws_opsworks_stack_test.go:721:21
  • resource_aws_opsworks_stack_test.go:988:21
@ryndaniels ryndaniels added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. technical-debt Addresses areas of the codebase that need refactoring or redesign. labels Jun 13, 2019
bflad added a commit that referenced this issue Jun 21, 2019
…est configurations

Reference: #8983

Test configurations should omit `provider "aws"` declarations as these:

* Prevents the same configuration from successfully running against multiple AWS partitions (e.g. AWS Commercial and AWS GovCloud (US))
* Reconfigure the default testing provider configuration, which can cause unexpected behavior across multiple tests

In this pass, we cleanup the trivial cases of `region = "us-west-2"` declarations, which matches the default region the acceptance testing framework is configured. As an added benefit of these changes, some of these tests may begin passing in AWS GovCloud (US) and other partitions. Future updates will handle hardcoded region and availability zone testing.

Previously from `tfproviderlint -AT004 ./aws` (only relevant failures shown):

```
aws/data_source_aws_availability_zone_test.go:35:52: AT004: provider declaration should be omitted
aws/data_source_aws_canonical_user_id_test.go:44:51: AT004: provider declaration should be omitted
aws/data_source_aws_kms_ciphertext_test.go:57:55: AT004: provider declaration should be omitted
aws/data_source_aws_kms_ciphertext_test.go:74:58: AT004: provider declaration should be omitted
aws/data_source_aws_kms_ciphertext_test.go:92:70: AT004: provider declaration should be omitted
aws/data_source_aws_nat_gateway_test.go:45:21: AT004: provider declaration should be omitted
aws/data_source_aws_prefix_list_test.go:60:46: AT004: provider declaration should be omitted
aws/data_source_aws_sns_test.go:52:44: AT004: provider declaration should be omitted
aws/data_source_aws_vpc_test.go:134:21: AT004: provider declaration should be omitted
aws/data_source_aws_vpc_test.go:155:21: AT004: provider declaration should be omitted
aws/resource_aws_autoscaling_group_test.go:2481:67: AT004: provider declaration should be omitted
aws/resource_aws_autoscaling_group_test.go:2624:21: AT004: provider declaration should be omitted
aws/resource_aws_default_route_table_test.go:241:41: AT004: provider declaration should be omitted
aws/resource_aws_default_route_table_test.go:291:45: AT004: provider declaration should be omitted
aws/resource_aws_default_route_table_test.go:384:47: AT004: provider declaration should be omitted
aws/resource_aws_default_vpc_test.go:50:41: AT004: provider declaration should be omitted
aws/resource_aws_elb_test.go:1680:37: AT004: provider declaration should be omitted
aws/resource_aws_elb_test.go:1751:41: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_custom_layer_test.go:349:21: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_rails_app_layer_test.go:79:21: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_rails_app_layer_test.go:103:21: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_stack_test.go:726:21: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_stack_test.go:819:21: AT004: provider declaration should be omitted
aws/resource_aws_subnet_test.go:456:47: AT004: provider declaration should be omitted
aws/resource_aws_vpc_endpoint_route_table_association_test.go:105:55: AT004: provider declaration should be omitted
```

Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups (81.06s)
--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups_ELBCapacity (372.99s)
--- PASS: TestAccAWSDefaultRouteTable_basic (77.18s)
--- PASS: TestAccAWSDefaultRouteTable_Route_TransitGatewayID (314.28s)
--- PASS: TestAccAWSDefaultRouteTable_swap (62.06s)
--- PASS: TestAccAWSDefaultRouteTable_vpc_endpoint (44.30s)
--- PASS: TestAccAWSDefaultVpc_basic (23.95s)
--- PASS: TestAccAWSELB_swap_subnets (74.50s)
--- PASS: TestAccAWSOpsworksCustomLayer_importBasic (42.93s)
--- PASS: TestAccAWSOpsworksRailsAppLayer (59.16s)
--- PASS: TestAccAWSOpsworksStackNoVpcCreateTags (36.37s)
--- PASS: TestAccAWSSubnet_availabilityZoneId (32.60s)
--- PASS: TestAccAWSVpcEndpointRouteTableAssociation_basic (44.86s)
--- PASS: TestAccDataSourceAwsAvailabilityZone (12.31s)
--- PASS: TestAccDataSourceAwsCanonicalUserId_basic (11.20s)
--- PASS: TestAccDataSourceAwsKmsCiphertext_basic (39.08s)
--- PASS: TestAccDataSourceAwsKmsCiphertext_validate (39.13s)
--- PASS: TestAccDataSourceAwsKmsCiphertext_validate_withContext (39.34s)
--- PASS: TestAccDataSourceAwsNatGateway (215.82s)
--- PASS: TestAccDataSourceAwsPrefixList (11.04s)
--- PASS: TestAccDataSourceAwsSnsTopic (14.32s)
--- PASS: TestAccDataSourceAwsVpc_basic (36.01s)
--- PASS: TestAccDataSourceAwsVpc_ipv6Associated (34.89s)
--- PASS: TestAccDataSourceAwsVpc_multipleCidr (53.00s)
```
bflad added a commit that referenced this issue Jun 21, 2019
…gurations except aws_lightsail_domain

Reference: #8983

When the AWS Lightsail service originally launched and was developed within Terraform, it was only available in the us-east-1 region. Here we update the test configurations to remove the hardcoded provider declaration (defaulting now to us-west-2 and passing in that region as matches in the Contributing Guide). This also switches the configurations to use the `amazon_linux` Blueprint, which is available in all Lightsail regions.

Previously before switching blueprint:

```
--- FAIL: TestAccAWSLightsailInstance_basic (8.69s)
    testing.go:568: Step 0 error: errors during apply:

        Error: InvalidInputException: The GitLab CE blueprint gitlab_8_12_6 is not available in us-west-2
```

Blueprint search in all AWS Commercial EC2 regions:

```console
$ for REGION in $(aws ec2 describe-regions --query 'Regions[].RegionName' --output text); do
  if [[ "$(aws --region $REGION lightsail get-blueprints --query 'blueprints[?blueprintId==`amazon_linux`].blueprintId' --output text)" == "amazon_linux" ]]; then
    echo "Found amazon_linux in $REGION"
  else
    echo "Missing amazon_linux in $REGION"
  fi
done

An error occurred (AccessDeniedException) when calling the GetBlueprints operation:
Missing amazon_linux in eu-north-1
Found amazon_linux in ap-south-1
Found amazon_linux in eu-west-3
Found amazon_linux in eu-west-2
Found amazon_linux in eu-west-1
Found amazon_linux in ap-northeast-2
Found amazon_linux in ap-northeast-1

Could not connect to the endpoint URL: "https://lightsail.sa-east-1.amazonaws.com/"
Missing amazon_linux in sa-east-1
Found amazon_linux in ca-central-1
Found amazon_linux in ap-southeast-1
Found amazon_linux in ap-southeast-2
Found amazon_linux in eu-central-1
Found amazon_linux in us-east-1
Found amazon_linux in us-east-2

Could not connect to the endpoint URL: "https://lightsail.us-west-1.amazonaws.com/"
Missing amazon_linux in us-west-1
Found amazon_linux in us-west-2
```

The `aws_lightsail_domain` hardcoded us-east-1 configuration will be handled in a future update as this resource is required to exist in us-east-1:

```
--- FAIL: TestAccAWSLightsailDomain_basic (5.65s)
    testing.go:568: Step 0 error: errors during apply:

        Error: InvalidInputException: Domain-related APIs are only available in the us-east-1 Region. Please set your Region configuration to us-east-1 to create, view, or edit these resources.
```

Previous output from tfproviderlint AT004 (only relevant check failures shown):

```
aws/resource_aws_lightsail_instance_test.go:180:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_instance_test.go:195:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_key_pair_test.go:171:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_key_pair_test.go:183:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_key_pair_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_key_pair_test.go:213:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_static_ip_attachment_test.go:137:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_static_ip_test.go:183:21: AT004: provider declaration should be omitted
```

Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAWSLightsailStaticIp_disappears (11.47s)
--- PASS: TestAccAWSLightsailStaticIp_basic (13.36s)
--- PASS: TestAccAWSLightsailKeyPair_imported (24.50s)
--- PASS: TestAccAWSLightsailKeyPair_encrypted (24.96s)
--- PASS: TestAccAWSLightsailKeyPair_basic (25.17s)
--- PASS: TestAccAWSLightsailKeyPair_nameprefix (25.74s)
--- PASS: TestAccAWSLightsailInstance_disapear (60.65s)
--- PASS: TestAccAWSLightsailInstance_basic (62.58s)
--- PASS: TestAccAWSLightsailStaticIpAttachment_disappears (80.43s)
--- PASS: TestAccAWSLightsailStaticIpAttachment_basic (81.75s)
```

Output from acceptance testing in AWS GovCloud (US): Service not available in this partition
bflad added a commit that referenced this issue Jul 10, 2019
…gurations except aws_lightsail_domain

Reference: #8983

When the AWS Lightsail service originally launched and was developed within Terraform, it was only available in the us-east-1 region. Here we update the test configurations to remove the hardcoded provider declaration (defaulting now to us-west-2 and passing in that region as matches in the Contributing Guide). This also switches the configurations to use the `amazon_linux` Blueprint, which is available in all Lightsail regions.

Previously before switching blueprint:

```
--- FAIL: TestAccAWSLightsailInstance_basic (8.69s)
    testing.go:568: Step 0 error: errors during apply:

        Error: InvalidInputException: The GitLab CE blueprint gitlab_8_12_6 is not available in us-west-2
```

Blueprint search in all AWS Commercial EC2 regions:

```console
$ for REGION in $(aws ec2 describe-regions --query 'Regions[].RegionName' --output text); do
  if [[ "$(aws --region $REGION lightsail get-blueprints --query 'blueprints[?blueprintId==`amazon_linux`].blueprintId' --output text)" == "amazon_linux" ]]; then
    echo "Found amazon_linux in $REGION"
  else
    echo "Missing amazon_linux in $REGION"
  fi
done

An error occurred (AccessDeniedException) when calling the GetBlueprints operation:
Missing amazon_linux in eu-north-1
Found amazon_linux in ap-south-1
Found amazon_linux in eu-west-3
Found amazon_linux in eu-west-2
Found amazon_linux in eu-west-1
Found amazon_linux in ap-northeast-2
Found amazon_linux in ap-northeast-1

Could not connect to the endpoint URL: "https://lightsail.sa-east-1.amazonaws.com/"
Missing amazon_linux in sa-east-1
Found amazon_linux in ca-central-1
Found amazon_linux in ap-southeast-1
Found amazon_linux in ap-southeast-2
Found amazon_linux in eu-central-1
Found amazon_linux in us-east-1
Found amazon_linux in us-east-2

Could not connect to the endpoint URL: "https://lightsail.us-west-1.amazonaws.com/"
Missing amazon_linux in us-west-1
Found amazon_linux in us-west-2
```

The `aws_lightsail_domain` hardcoded us-east-1 configuration will be handled in a future update as this resource is required to exist in us-east-1:

```
--- FAIL: TestAccAWSLightsailDomain_basic (5.65s)
    testing.go:568: Step 0 error: errors during apply:

        Error: InvalidInputException: Domain-related APIs are only available in the us-east-1 Region. Please set your Region configuration to us-east-1 to create, view, or edit these resources.
```

Previous output from tfproviderlint AT004 (only relevant check failures shown):

```
aws/resource_aws_lightsail_instance_test.go:180:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_instance_test.go:195:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_key_pair_test.go:171:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_key_pair_test.go:183:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_key_pair_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_key_pair_test.go:213:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_static_ip_attachment_test.go:137:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_static_ip_test.go:183:21: AT004: provider declaration should be omitted
```

Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAWSLightsailStaticIp_disappears (11.47s)
--- PASS: TestAccAWSLightsailStaticIp_basic (13.36s)
--- PASS: TestAccAWSLightsailKeyPair_imported (24.50s)
--- PASS: TestAccAWSLightsailKeyPair_encrypted (24.96s)
--- PASS: TestAccAWSLightsailKeyPair_basic (25.17s)
--- PASS: TestAccAWSLightsailKeyPair_nameprefix (25.74s)
--- PASS: TestAccAWSLightsailInstance_disapear (60.65s)
--- PASS: TestAccAWSLightsailInstance_basic (62.58s)
--- PASS: TestAccAWSLightsailStaticIpAttachment_disappears (80.43s)
--- PASS: TestAccAWSLightsailStaticIpAttachment_basic (81.75s)
```

Output from acceptance testing in AWS GovCloud (US): Service not available in this partition
nywilken pushed a commit that referenced this issue Jul 10, 2019
Reference: #8983

When the AWS Lightsail service originally launched and was developed within Terraform, it was only available in the us-east-1 region. Here we update the test configurations to remove the hardcoded provider declaration (defaulting now to us-west-2 and passing in that region as matches in the Contributing Guide). This also switches the configurations to use the `amazon_linux` Blueprint, which is available in all Lightsail regions.

Previously before switching blueprint:

```
--- FAIL: TestAccAWSLightsailInstance_basic (8.69s)
    testing.go:568: Step 0 error: errors during apply:

        Error: InvalidInputException: The GitLab CE blueprint gitlab_8_12_6 is not available in us-west-2
```

Blueprint search in all AWS Commercial EC2 regions:

```console
$ for REGION in $(aws ec2 describe-regions --query 'Regions[].RegionName' --output text); do
  if [[ "$(aws --region $REGION lightsail get-blueprints --query 'blueprints[?blueprintId==`amazon_linux`].blueprintId' --output text)" == "amazon_linux" ]]; then
    echo "Found amazon_linux in $REGION"
  else
    echo "Missing amazon_linux in $REGION"
  fi
done

An error occurred (AccessDeniedException) when calling the GetBlueprints operation:
Missing amazon_linux in eu-north-1
Found amazon_linux in ap-south-1
Found amazon_linux in eu-west-3
Found amazon_linux in eu-west-2
Found amazon_linux in eu-west-1
Found amazon_linux in ap-northeast-2
Found amazon_linux in ap-northeast-1

Could not connect to the endpoint URL: "https://lightsail.sa-east-1.amazonaws.com/"
Missing amazon_linux in sa-east-1
Found amazon_linux in ca-central-1
Found amazon_linux in ap-southeast-1
Found amazon_linux in ap-southeast-2
Found amazon_linux in eu-central-1
Found amazon_linux in us-east-1
Found amazon_linux in us-east-2

Could not connect to the endpoint URL: "https://lightsail.us-west-1.amazonaws.com/"
Missing amazon_linux in us-west-1
Found amazon_linux in us-west-2
```

The `aws_lightsail_domain` hardcoded us-east-1 configuration will be handled in a future update as this resource is required to exist in us-east-1:

```
--- FAIL: TestAccAWSLightsailDomain_basic (5.65s)
    testing.go:568: Step 0 error: errors during apply:

        Error: InvalidInputException: Domain-related APIs are only available in the us-east-1 Region. Please set your Region configuration to us-east-1 to create, view, or edit these resources.
```

Previous output from tfproviderlint AT004 (only relevant check failures shown):

```
aws/resource_aws_lightsail_instance_test.go:180:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_instance_test.go:195:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_key_pair_test.go:171:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_key_pair_test.go:183:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_key_pair_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_key_pair_test.go:213:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_static_ip_attachment_test.go:137:21: AT004: provider declaration should be omitted
aws/resource_aws_lightsail_static_ip_test.go:183:21: AT004: provider declaration should be omitted
```

Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAWSLightsailStaticIp_disappears (11.47s)
--- PASS: TestAccAWSLightsailStaticIp_basic (13.36s)
--- PASS: TestAccAWSLightsailKeyPair_imported (24.50s)
--- PASS: TestAccAWSLightsailKeyPair_encrypted (24.96s)
--- PASS: TestAccAWSLightsailKeyPair_basic (25.17s)
--- PASS: TestAccAWSLightsailKeyPair_nameprefix (25.74s)
--- PASS: TestAccAWSLightsailInstance_disapear (60.65s)
--- PASS: TestAccAWSLightsailInstance_basic (62.58s)
--- PASS: TestAccAWSLightsailStaticIpAttachment_disappears (80.43s)
--- PASS: TestAccAWSLightsailStaticIpAttachment_basic (81.75s)
```

Output from acceptance testing in AWS GovCloud (US): Service not available in this partition
nywilken pushed a commit that referenced this issue Jul 10, 2019
Reference: #8983

Test configurations should omit `provider "aws"` declarations as these:

* Prevents the same configuration from successfully running against multiple AWS partitions (e.g. AWS Commercial and AWS GovCloud (US))
* Reconfigure the default testing provider configuration, which can cause unexpected behavior across multiple tests

In this pass, we cleanup the trivial cases of `region = "us-west-2"` declarations, which matches the default region the acceptance testing framework is configured. As an added benefit of these changes, some of these tests may begin passing in AWS GovCloud (US) and other partitions. Future updates will handle hardcoded region and availability zone testing.

Previously from `tfproviderlint -AT004 ./aws` (only relevant failures shown):

```
aws/data_source_aws_availability_zone_test.go:35:52: AT004: provider declaration should be omitted
aws/data_source_aws_canonical_user_id_test.go:44:51: AT004: provider declaration should be omitted
aws/data_source_aws_kms_ciphertext_test.go:57:55: AT004: provider declaration should be omitted
aws/data_source_aws_kms_ciphertext_test.go:74:58: AT004: provider declaration should be omitted
aws/data_source_aws_kms_ciphertext_test.go:92:70: AT004: provider declaration should be omitted
aws/data_source_aws_nat_gateway_test.go:45:21: AT004: provider declaration should be omitted
aws/data_source_aws_prefix_list_test.go:60:46: AT004: provider declaration should be omitted
aws/data_source_aws_sns_test.go:52:44: AT004: provider declaration should be omitted
aws/data_source_aws_vpc_test.go:134:21: AT004: provider declaration should be omitted
aws/data_source_aws_vpc_test.go:155:21: AT004: provider declaration should be omitted
aws/resource_aws_autoscaling_group_test.go:2481:67: AT004: provider declaration should be omitted
aws/resource_aws_autoscaling_group_test.go:2624:21: AT004: provider declaration should be omitted
aws/resource_aws_default_route_table_test.go:241:41: AT004: provider declaration should be omitted
aws/resource_aws_default_route_table_test.go:291:45: AT004: provider declaration should be omitted
aws/resource_aws_default_route_table_test.go:384:47: AT004: provider declaration should be omitted
aws/resource_aws_default_vpc_test.go:50:41: AT004: provider declaration should be omitted
aws/resource_aws_elb_test.go:1680:37: AT004: provider declaration should be omitted
aws/resource_aws_elb_test.go:1751:41: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_custom_layer_test.go:349:21: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_rails_app_layer_test.go:79:21: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_rails_app_layer_test.go:103:21: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_stack_test.go:726:21: AT004: provider declaration should be omitted
aws/resource_aws_opsworks_stack_test.go:819:21: AT004: provider declaration should be omitted
aws/resource_aws_subnet_test.go:456:47: AT004: provider declaration should be omitted
aws/resource_aws_vpc_endpoint_route_table_association_test.go:105:55: AT004: provider declaration should be omitted
```

Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups (81.06s)
--- PASS: TestAccAWSAutoScalingGroup_ALB_TargetGroups_ELBCapacity (372.99s)
--- PASS: TestAccAWSDefaultRouteTable_basic (77.18s)
--- PASS: TestAccAWSDefaultRouteTable_Route_TransitGatewayID (314.28s)
--- PASS: TestAccAWSDefaultRouteTable_swap (62.06s)
--- PASS: TestAccAWSDefaultRouteTable_vpc_endpoint (44.30s)
--- PASS: TestAccAWSDefaultVpc_basic (23.95s)
--- PASS: TestAccAWSELB_swap_subnets (74.50s)
--- PASS: TestAccAWSOpsworksCustomLayer_importBasic (42.93s)
--- PASS: TestAccAWSOpsworksRailsAppLayer (59.16s)
--- PASS: TestAccAWSOpsworksStackNoVpcCreateTags (36.37s)
--- PASS: TestAccAWSSubnet_availabilityZoneId (32.60s)
--- PASS: TestAccAWSVpcEndpointRouteTableAssociation_basic (44.86s)
--- PASS: TestAccDataSourceAwsAvailabilityZone (12.31s)
--- PASS: TestAccDataSourceAwsCanonicalUserId_basic (11.20s)
--- PASS: TestAccDataSourceAwsKmsCiphertext_basic (39.08s)
--- PASS: TestAccDataSourceAwsKmsCiphertext_validate (39.13s)
--- PASS: TestAccDataSourceAwsKmsCiphertext_validate_withContext (39.34s)
--- PASS: TestAccDataSourceAwsNatGateway (215.82s)
--- PASS: TestAccDataSourceAwsPrefixList (11.04s)
--- PASS: TestAccDataSourceAwsSnsTopic (14.32s)
--- PASS: TestAccDataSourceAwsVpc_basic (36.01s)
--- PASS: TestAccDataSourceAwsVpc_ipv6Associated (34.89s)
--- PASS: TestAccDataSourceAwsVpc_multipleCidr (53.00s)
```
@bflad bflad self-assigned this Mar 4, 2020
bflad added a commit that referenced this issue Mar 5, 2020
… in test configurations

Reference: #8983
Reference: https://github.com/terraform-providers/terraform-provider-aws/blob/master/.github/CONTRIBUTING.md#writing-and-running-cross-region-acceptance-tests

This is the first round of tfproviderlint AT004 fixes. Remaining reports will require some additional design work, e.g. potentially creating a separate EC2 Classic provider in the acceptance testing framework.

Previously:

```
aws/data_source_aws_elastic_beanstalk_hosted_zone_test.go:42:75: AT004: provider declaration should be omitted
aws/provider_test.go:425:21: AT004: provider declaration should be omitted
...
aws/provider_test.go:1259:21: AT004: provider declaration should be omitted
aws/resource_aws_ami_from_instance_test.go:131:21: AT004: provider declaration should be omitted
aws/resource_aws_codecommit_trigger_test.go:84:40: AT004: provider declaration should be omitted
aws/resource_aws_dynamodb_global_table_test.go:186:21: AT004: provider declaration should be omitted
aws/resource_aws_eip_test.go:999:21: AT004: provider declaration should be
aws/resource_aws_pinpoint_adm_channel_test.go:115:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_channel_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_channel_test.go:215:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_sandbox_channel_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_sandbox_channel_test.go:215:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_voip_channel_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_voip_channel_test.go:215:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_voip_sandbox_channel_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_voip_sandbox_channel_test.go:215:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_baidu_channel_test.go:109:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_baidu_channel_test.go:91:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_email_channel_test.go:141:53: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_email_channel_test.go:83:52: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_event_stream_test.go:136:52: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_event_stream_test.go:79:51: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_gcm_channel_test.go:95:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_sms_channel_test.go:146:50: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_sms_channel_test.go:158:21: AT004: provider declaration should be omitted
aws/resource_aws_rds_cluster_test.go:2796:21: AT004: provider declaration should be omitted
aws/resource_aws_route53_zone_association_test.go:267:51: AT004: provider declaration should be omitted
aws/resource_aws_s3_bucket_test.go:2772:21: AT004: provider declaration should be omitted
aws/resource_aws_s3_bucket_test.go:3268:50: AT004: provider declaration should be omitted
```

Output from acceptance testing:

```
--- PASS: TestAccAWSDataSourceElasticBeanstalkHostedZone_basic (15.30s)
--- PASS: TestAccAWSDataSourceElasticBeanstalkHostedZone_Region (19.40s)

--- PASS: TestAccAWSAMIFromInstance_basic (458.33s)
--- PASS: TestAccAWSAMIFromInstance_tags (459.26s)

--- PASS: TestAccAWSCodeCommitTrigger_basic (16.98s)

--- PASS: TestAccAWSDynamoDbGlobalTable_multipleRegions (107.60s)

--- PASS: TestAccAWSEIP_Instance_Reassociate (120.78s)

--- SKIP: TestAccAWSPinpointADMChannel_basic (0.00s)
    resource_aws_pinpoint_adm_channel_test.go:30: ADM_CLIENT_ID ENV is missing

--- SKIP: TestAccAWSPinpointAPNSChannel_basicCertificate (0.00s)
    resource_aws_pinpoint_apns_channel_test.go:58: Pinpoint certificate credentials envs are missing, skipping test
--- SKIP: TestAccAWSPinpointAPNSChannel_basicToken (0.00s)
    resource_aws_pinpoint_apns_channel_test.go:66: APNS_BUNDLE_ID env is missing, skipping test

--- SKIP: TestAccAWSPinpointAPNSSandboxChannel_basicCertificate (0.00s)
    resource_aws_pinpoint_apns_sandbox_channel_test.go:58: Pinpoint certificate credentials envs are missing, skipping test
--- SKIP: TestAccAWSPinpointAPNSSandboxChannel_basicToken (0.00s)
    resource_aws_pinpoint_apns_sandbox_channel_test.go:66: APNS_SANDBOX_BUNDLE_ID env is missing, skipping test

--- SKIP: TestAccAWSPinpointAPNSVoipChannel_basicCertificate (0.00s)
    resource_aws_pinpoint_apns_voip_channel_test.go:58: Pinpoint certificate credentials envs are missing, skipping test
--- SKIP: TestAccAWSPinpointAPNSVoipChannel_basicToken (0.00s)
    resource_aws_pinpoint_apns_voip_channel_test.go:66: APNS_VOIP_BUNDLE_ID env is missing, skipping test

--- SKIP: TestAccAWSPinpointAPNSVoipSandboxChannel_basicCertificate (0.00s)
    resource_aws_pinpoint_apns_voip_sandbox_channel_test.go:58: Pinpoint certificate credentials envs are missing, skipping test
--- SKIP: TestAccAWSPinpointAPNSVoipSandboxChannel_basicToken (0.00s)
    resource_aws_pinpoint_apns_voip_sandbox_channel_test.go:66: APNS_VOIP_BUNDLE_ID env is missing, skipping test

--- SKIP: TestAccAWSPinpointGCMChannel_basic (0.00s)
    resource_aws_pinpoint_gcm_channel_test.go:26: GCM_API_KEY env missing, skip test

--- PASS: TestAccAWSPinpointApp_basic (18.30s)
--- PASS: TestAccAWSPinpointApp_CampaignHookLambda (51.62s)
--- PASS: TestAccAWSPinpointApp_Limits (16.81s)
--- PASS: TestAccAWSPinpointApp_QuietTime (16.39s)
--- PASS: TestAccAWSPinpointApp_Tags (39.82s)

--- PASS: TestAccAWSPinpointBaiduChannel_basic (27.75s)

--- PASS: TestAccAWSPinpointEmailChannel_basic (31.77s)

--- PASS: TestAccAWSPinpointEventStream_basic (192.97s)

--- PASS: TestAccAWSPinpointSMSChannel_basic (27.71s)
--- PASS: TestAccAWSPinpointSMSChannel_full (29.13s)

--- PASS: TestAccAWSRDSCluster_EncryptedCrossRegionReplication (1593.29s)

--- PASS: TestAccAWSRoute53ZoneAssociation_region (161.54s)

--- PASS: TestAccAWSS3Bucket_region (38.19s)
--- PASS: TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError (28.48s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutPrefix (55.65s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutStorageClass (56.38s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AccessControlTranslation (108.97s)
--- PASS: TestAccAWSS3Bucket_ReplicationSchemaV2 (161.13s)
--- PASS: TestAccAWSS3Bucket_Replication (172.15s)
```

In a region where Pinpoint is not supported, all tests continue to skip:

```
--- SKIP: TestAccAWSPinpointApp_basic (27.81s)
    resource_aws_pinpoint_app_test.go:228: skipping acceptance testing: RequestError: send request failed
        caused by: Get https://pinpoint.us-east-2.amazonaws.com/v1/apps: dial tcp: lookup pinpoint.us-east-2.amazonaws.com: no such host
```
bflad added a commit that referenced this issue Mar 10, 2020
… in test configurations (#12277)

Reference: #8983
Reference: https://github.com/terraform-providers/terraform-provider-aws/blob/master/.github/CONTRIBUTING.md#writing-and-running-cross-region-acceptance-tests

This is the first round of tfproviderlint AT004 fixes. Remaining reports will require some additional design work, e.g. potentially creating a separate EC2 Classic provider in the acceptance testing framework.

Previously:

```
aws/data_source_aws_elastic_beanstalk_hosted_zone_test.go:42:75: AT004: provider declaration should be omitted
aws/provider_test.go:425:21: AT004: provider declaration should be omitted
...
aws/provider_test.go:1259:21: AT004: provider declaration should be omitted
aws/resource_aws_ami_from_instance_test.go:131:21: AT004: provider declaration should be omitted
aws/resource_aws_codecommit_trigger_test.go:84:40: AT004: provider declaration should be omitted
aws/resource_aws_dynamodb_global_table_test.go:186:21: AT004: provider declaration should be omitted
aws/resource_aws_eip_test.go:999:21: AT004: provider declaration should be
aws/resource_aws_pinpoint_adm_channel_test.go:115:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_channel_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_channel_test.go:215:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_sandbox_channel_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_sandbox_channel_test.go:215:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_voip_channel_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_voip_channel_test.go:215:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_voip_sandbox_channel_test.go:197:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_apns_voip_sandbox_channel_test.go:215:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_baidu_channel_test.go:109:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_baidu_channel_test.go:91:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_email_channel_test.go:141:53: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_email_channel_test.go:83:52: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_event_stream_test.go:136:52: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_event_stream_test.go:79:51: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_gcm_channel_test.go:95:21: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_sms_channel_test.go:146:50: AT004: provider declaration should be omitted
aws/resource_aws_pinpoint_sms_channel_test.go:158:21: AT004: provider declaration should be omitted
aws/resource_aws_rds_cluster_test.go:2796:21: AT004: provider declaration should be omitted
aws/resource_aws_route53_zone_association_test.go:267:51: AT004: provider declaration should be omitted
aws/resource_aws_s3_bucket_test.go:2772:21: AT004: provider declaration should be omitted
aws/resource_aws_s3_bucket_test.go:3268:50: AT004: provider declaration should be omitted
```

Output from acceptance testing:

```
--- PASS: TestAccAWSDataSourceElasticBeanstalkHostedZone_basic (15.30s)
--- PASS: TestAccAWSDataSourceElasticBeanstalkHostedZone_Region (19.40s)

--- PASS: TestAccAWSAMIFromInstance_basic (458.33s)
--- PASS: TestAccAWSAMIFromInstance_tags (459.26s)

--- PASS: TestAccAWSCodeCommitTrigger_basic (16.98s)

--- PASS: TestAccAWSDynamoDbGlobalTable_multipleRegions (107.60s)

--- PASS: TestAccAWSEIP_Instance_Reassociate (120.78s)

--- SKIP: TestAccAWSPinpointADMChannel_basic (0.00s)
    resource_aws_pinpoint_adm_channel_test.go:30: ADM_CLIENT_ID ENV is missing

--- SKIP: TestAccAWSPinpointAPNSChannel_basicCertificate (0.00s)
    resource_aws_pinpoint_apns_channel_test.go:58: Pinpoint certificate credentials envs are missing, skipping test
--- SKIP: TestAccAWSPinpointAPNSChannel_basicToken (0.00s)
    resource_aws_pinpoint_apns_channel_test.go:66: APNS_BUNDLE_ID env is missing, skipping test

--- SKIP: TestAccAWSPinpointAPNSSandboxChannel_basicCertificate (0.00s)
    resource_aws_pinpoint_apns_sandbox_channel_test.go:58: Pinpoint certificate credentials envs are missing, skipping test
--- SKIP: TestAccAWSPinpointAPNSSandboxChannel_basicToken (0.00s)
    resource_aws_pinpoint_apns_sandbox_channel_test.go:66: APNS_SANDBOX_BUNDLE_ID env is missing, skipping test

--- SKIP: TestAccAWSPinpointAPNSVoipChannel_basicCertificate (0.00s)
    resource_aws_pinpoint_apns_voip_channel_test.go:58: Pinpoint certificate credentials envs are missing, skipping test
--- SKIP: TestAccAWSPinpointAPNSVoipChannel_basicToken (0.00s)
    resource_aws_pinpoint_apns_voip_channel_test.go:66: APNS_VOIP_BUNDLE_ID env is missing, skipping test

--- SKIP: TestAccAWSPinpointAPNSVoipSandboxChannel_basicCertificate (0.00s)
    resource_aws_pinpoint_apns_voip_sandbox_channel_test.go:58: Pinpoint certificate credentials envs are missing, skipping test
--- SKIP: TestAccAWSPinpointAPNSVoipSandboxChannel_basicToken (0.00s)
    resource_aws_pinpoint_apns_voip_sandbox_channel_test.go:66: APNS_VOIP_BUNDLE_ID env is missing, skipping test

--- SKIP: TestAccAWSPinpointGCMChannel_basic (0.00s)
    resource_aws_pinpoint_gcm_channel_test.go:26: GCM_API_KEY env missing, skip test

--- PASS: TestAccAWSPinpointApp_basic (18.30s)
--- PASS: TestAccAWSPinpointApp_CampaignHookLambda (51.62s)
--- PASS: TestAccAWSPinpointApp_Limits (16.81s)
--- PASS: TestAccAWSPinpointApp_QuietTime (16.39s)
--- PASS: TestAccAWSPinpointApp_Tags (39.82s)

--- PASS: TestAccAWSPinpointBaiduChannel_basic (27.75s)

--- PASS: TestAccAWSPinpointEmailChannel_basic (31.77s)

--- PASS: TestAccAWSPinpointEventStream_basic (192.97s)

--- PASS: TestAccAWSPinpointSMSChannel_basic (27.71s)
--- PASS: TestAccAWSPinpointSMSChannel_full (29.13s)

--- PASS: TestAccAWSRDSCluster_EncryptedCrossRegionReplication (1593.29s)

--- PASS: TestAccAWSRoute53ZoneAssociation_region (161.54s)

--- PASS: TestAccAWSS3Bucket_region (38.19s)
--- PASS: TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError (28.48s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutPrefix (55.65s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutStorageClass (56.38s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AccessControlTranslation (108.97s)
--- PASS: TestAccAWSS3Bucket_ReplicationSchemaV2 (161.13s)
--- PASS: TestAccAWSS3Bucket_Replication (172.15s)
```

In a region where Pinpoint is not supported, all tests continue to skip:

```
--- SKIP: TestAccAWSPinpointApp_basic (27.81s)
    resource_aws_pinpoint_app_test.go:228: skipping acceptance testing: RequestError: send request failed
        caused by: Get https://pinpoint.us-east-2.amazonaws.com/v1/apps: dial tcp: lookup pinpoint.us-east-2.amazonaws.com: no such host
```
@bflad bflad added this to the v3.17.0 milestone Nov 19, 2020
@ghost
Copy link

ghost commented Nov 24, 2020

This has been released in version 3.17.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Dec 19, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Dec 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
technical-debt Addresses areas of the codebase that need refactoring or redesign. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants