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

tests/service/lightsail: Remove hardcoded us-east-1 region from configurations except aws_lightsail_domain #9080

Merged
merged 1 commit into from
Jul 10, 2019

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Jun 21, 2019

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

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:

$ 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

Release note for CHANGELOG:

NONE

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 bflad requested a review from a team June 21, 2019 11:55
@ghost ghost added size/M Managed by automation to categorize the size of a PR. service/lightsail Issues and PRs that pertain to the lightsail service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels 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 bflad force-pushed the td-tfproviderlint-AT004-lightsail branch from c7f8147 to 6547302 Compare July 10, 2019 02:16
@bflad
Copy link
Contributor Author

bflad commented Jul 10, 2019

Rebased on master. 👍

Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 👍

@nywilken nywilken added this to the v2.19.0 milestone Jul 10, 2019
@nywilken nywilken merged commit bce112d into master Jul 10, 2019
@nywilken nywilken deleted the td-tfproviderlint-AT004-lightsail branch July 10, 2019 18:12
@ghost
Copy link

ghost commented Nov 2, 2019

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 and limited conversation to collaborators Nov 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/lightsail Issues and PRs that pertain to the lightsail service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants