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

resource/aws_elasticsearch_domain: Ensure in-place version upgrade is fully successful before returning #11793

Merged
merged 1 commit into from
Jan 30, 2020

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Jan 29, 2020

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" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Release note for CHANGELOG:

* resource/aws_elasticsearch_domain: Ensure in-place version upgrade is fully successful before returning

Previously in the acceptance testing:

--- FAIL: TestAccAWSElasticSearchDomain_update_version (901.47s)
    testing.go:640: Step 2 error: Check failed: Check 3/3 error: aws_elasticsearch_domain.test: Attribute 'elasticsearch_version' expected "5.6", got "5.5"

The AWS Elasticsearch service upgrade process uses the same response object with multiple step values (Elasticsearch User Guide or more clearly, the AWS CLI documentation). The previous logic had race condition for when the actual upgrade step was the one that was completed, e.g.

2020/01/28 21:47:05 [DEBUG] [aws-sdk-go] DEBUG: Response es/GetUpgradeStatus Details:
...
2020/01/28 21:47:05 [DEBUG] [aws-sdk-go] {"StepStatus":"SUCCEEDED","UpgradeName":"Upgrade from 5.5 to 5.6","UpgradeStep":"SNAPSHOT"}

During the actual upgrade, the UpgradeStep is named UPGRADE:

2020/01/29 08:30:07 [DEBUG] [aws-sdk-go] {"StepStatus":"IN_PROGRESS","UpgradeName":"Upgrade from 5.5 to 5.6","UpgradeStep":"UPGRADE"}

We will now only consider upgrade status refresh function StepStatus of SUCCEEDED only on the UpgradeStep value of UPGRADE.

Output from acceptance testing:

--- PASS: TestAccAWSElasticSearchDomain_basic (2441.12s)
--- PASS: TestAccAWSElasticSearchDomain_ClusterConfig_ZoneAwarenessConfig (5287.37s)
--- PASS: TestAccAWSElasticSearchDomain_CognitoOptionsCreateAndRemove (1881.56s)
--- PASS: TestAccAWSElasticSearchDomain_CognitoOptionsUpdate (2385.75s)
--- PASS: TestAccAWSElasticSearchDomain_complex (1040.02s)
--- PASS: TestAccAWSElasticSearchDomain_duplicate (403.91s)
--- PASS: TestAccAWSElasticSearchDomain_encrypt_at_rest_default_key (760.05s)
--- PASS: TestAccAWSElasticSearchDomain_encrypt_at_rest_specify_key (909.73s)
--- PASS: TestAccAWSElasticSearchDomain_internetToVpcEndpoint (2496.06s)
--- PASS: TestAccAWSElasticSearchDomain_LogPublishingOptions (1598.99s)
--- PASS: TestAccAWSElasticSearchDomain_NodeToNodeEncryption (1015.12s)
--- PASS: TestAccAWSElasticSearchDomain_policy (1832.67s)
--- PASS: TestAccAWSElasticSearchDomain_RequireHTTPS (2784.03s)
--- PASS: TestAccAWSElasticSearchDomain_tags (752.75s)
--- PASS: TestAccAWSElasticSearchDomain_update (1862.46s)
--- PASS: TestAccAWSElasticSearchDomain_update_version (3422.13s)
--- PASS: TestAccAWSElasticSearchDomain_update_volume_type (3397.51s)
--- PASS: TestAccAWSElasticSearchDomain_v23 (1323.39s)
--- PASS: TestAccAWSElasticSearchDomain_vpc (1045.76s)
--- PASS: TestAccAWSElasticSearchDomain_vpc_update (2579.22s)
--- PASS: TestAccAWSElasticSearchDomain_withDedicatedMaster (2644.34s)

… fully successful before returning

Previously in the acceptance testing:

```
--- FAIL: TestAccAWSElasticSearchDomain_update_version (901.47s)
    testing.go:640: Step 2 error: Check failed: Check 3/3 error: aws_elasticsearch_domain.test: Attribute 'elasticsearch_version' expected "5.6", got "5.5"
```

The AWS Elasticsearch service upgrade process uses the same response object with multiple step values ([Elasticsearch User Guide](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-version-migration.html) or more clearly, the [AWS CLI documentation](https://docs.aws.amazon.com/cli/latest/reference/es/get-upgrade-status.html)). The previous logic had race condition for when the actual upgrade step was the one that was completed, e.g.

```
2020/01/28 21:47:05 [DEBUG] [aws-sdk-go] DEBUG: Response es/GetUpgradeStatus Details:
...
2020/01/28 21:47:05 [DEBUG] [aws-sdk-go] {"StepStatus":"SUCCEEDED","UpgradeName":"Upgrade from 5.5 to 5.6","UpgradeStep":"SNAPSHOT"}
```

During the actual upgrade, the `UpgradeStep` is named `UPGRADE`:

```
2020/01/29 08:30:07 [DEBUG] [aws-sdk-go] {"StepStatus":"IN_PROGRESS","UpgradeName":"Upgrade from 5.5 to 5.6","UpgradeStep":"UPGRADE"}
```

We will now only consider upgrade status refresh function `StepStatus` of `SUCCEEDED` only on the `UpgradeStep` value of `UPGRADE`.

Output from acceptance testing:

```
--- PASS: TestAccAWSElasticSearchDomain_basic (2441.12s)
--- PASS: TestAccAWSElasticSearchDomain_ClusterConfig_ZoneAwarenessConfig (5287.37s)
--- PASS: TestAccAWSElasticSearchDomain_CognitoOptionsCreateAndRemove (1881.56s)
--- PASS: TestAccAWSElasticSearchDomain_CognitoOptionsUpdate (2385.75s)
--- PASS: TestAccAWSElasticSearchDomain_complex (1040.02s)
--- PASS: TestAccAWSElasticSearchDomain_duplicate (403.91s)
--- PASS: TestAccAWSElasticSearchDomain_encrypt_at_rest_default_key (760.05s)
--- PASS: TestAccAWSElasticSearchDomain_encrypt_at_rest_specify_key (909.73s)
--- PASS: TestAccAWSElasticSearchDomain_internetToVpcEndpoint (2496.06s)
--- PASS: TestAccAWSElasticSearchDomain_LogPublishingOptions (1598.99s)
--- PASS: TestAccAWSElasticSearchDomain_NodeToNodeEncryption (1015.12s)
--- PASS: TestAccAWSElasticSearchDomain_policy (1832.67s)
--- PASS: TestAccAWSElasticSearchDomain_RequireHTTPS (2784.03s)
--- PASS: TestAccAWSElasticSearchDomain_tags (752.75s)
--- PASS: TestAccAWSElasticSearchDomain_update (1862.46s)
--- PASS: TestAccAWSElasticSearchDomain_update_version (3422.13s)
--- PASS: TestAccAWSElasticSearchDomain_update_volume_type (3397.51s)
--- PASS: TestAccAWSElasticSearchDomain_v23 (1323.39s)
--- PASS: TestAccAWSElasticSearchDomain_vpc (1045.76s)
--- PASS: TestAccAWSElasticSearchDomain_vpc_update (2579.22s)
--- PASS: TestAccAWSElasticSearchDomain_withDedicatedMaster (2644.34s)
```
@bflad bflad added the bug Addresses a defect in current functionality. label Jan 29, 2020
@bflad bflad requested a review from a team January 29, 2020 16:00
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. size/XS Managed by automation to categorize the size of a PR. service/elasticsearch Issues and PRs that pertain to the elasticsearch service. labels Jan 29, 2020
@bflad bflad removed the needs-triage Waiting for first response or review from a maintainer. label Jan 29, 2020
@gdavison gdavison self-assigned this Jan 30, 2020
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

--- PASS: TestAccAWSElasticSearchDomain_duplicate (623.65s)
--- PASS: TestAccAWSElasticSearchDomain_tags (665.40s)
--- PASS: TestAccAWSElasticSearchDomain_NodeToNodeEncryption (825.46s)
--- PASS: TestAccAWSElasticSearchDomain_LogPublishingOptions (833.19s)
--- PASS: TestAccAWSElasticSearchDomain_policy (886.70s)
--- PASS: TestAccAWSElasticSearchDomain_basic (949.95s)
--- PASS: TestAccAWSElasticSearchDomainPolicy_basic (1106.33s)
--- PASS: TestAccAWSElasticSearchDomain_vpc (1229.65s)
--- PASS: TestAccAWSElasticSearchDomain_complex (1296.40s)
--- PASS: TestAccAWSElasticSearchDomain_encrypt_at_rest_default_key (1318.91s)
--- PASS: TestAccAWSElasticSearchDomain_v23 (1331.82s)
--- PASS: TestAccAWSElasticSearchDomain_encrypt_at_rest_specify_key (1421.12s)
--- PASS: TestAccAWSElasticSearchDomain_internetToVpcEndpoint (1786.48s)
--- PASS: TestAccAWSElasticSearchDomain_vpc_update (1961.17s)
--- PASS: TestAccAWSElasticSearchDomain_RequireHTTPS (2151.44s)
--- PASS: TestAccAWSElasticSearchDomain_update (2310.27s)
--- PASS: TestAccAWSElasticSearchDomain_CognitoOptionsCreateAndRemove (2334.12s)
--- PASS: TestAccAWSElasticSearchDomain_CognitoOptionsUpdate (2697.49s)
--- PASS: TestAccAWSElasticSearchDomain_update_volume_type (3145.16s)
--- PASS: TestAccAWSElasticSearchDomain_update_version (3218.29s)
--- PASS: TestAccAWSElasticSearchDomain_withDedicatedMaster (4030.70s)
--- PASS: TestAccAWSElasticSearchDomain_ClusterConfig_ZoneAwarenessConfig (4984.66s)

@bflad bflad added this to the v2.47.0 milestone Jan 30, 2020
@bflad bflad merged commit f64fbe7 into master Jan 30, 2020
@bflad bflad deleted the b-aws_elasticsearch_domain-wait-for-upgrade branch January 30, 2020 20:58
bflad added a commit that referenced this pull request Jan 30, 2020
@ghost
Copy link

ghost commented Jan 30, 2020

This has been released in version 2.47.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 Mar 27, 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 and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/elasticsearch Issues and PRs that pertain to the elasticsearch service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants