Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/service/lightsail: Remove hardcoded us-east-1 region from confi…
…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
- Loading branch information