hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.83k stars 9.18k forks source link

[TechDebt]: Add `PreCheck` to CloudSearch domain based tests #38584

Closed jar-b closed 3 months ago

jar-b commented 3 months ago

Description

In an effort to shift towards the OpenSearch service, AWS has recently introduced a change which prevents accounts with no active CloudSearch domains from creating new ones. The relevant context from the support case:

We introduced a change on July 25, wherein new accounts that don't already have one or more CloudSearch domains, will have to be explicitly allowlisted for new domain creation. If you would like to create a CloudSearch domain on an AWS account other than those that you are using today, we can allowlist it for new domain creation. This change does not affect existing CloudSearch domains, and you can continue to create new domains on existing accounts in which you already have CloudSearch domains running.

Acceptance tests for this service which rely on a domain should be updated with a PreCheck to skip on NotAuthorized exceptions.

=== RUN   TestAccCloudSearchDomain_basic
=== PAUSE TestAccCloudSearchDomain_basic
=== CONT  TestAccCloudSearchDomain_basic
    domain_test.go:28: Step 1/2 error: Error running apply: exit status 1
        Error: creating CloudSearch Domain (tf-acc-test-owp77qhzuy982v49): operation error CloudSearch: CreateDomain, https response error StatusCode: 401, RequestID: d75b043a-25ab-47d6-b62f-6925fa1097ae, api error NotAuthorized: New domain creation not supported on this account. Please reach out to AWS Support for assistance.
          with aws_cloudsearch_domain.test,
          on terraform_plugin_test.tf line 12, in resource "aws_cloudsearch_domain" "test":
          12: resource "aws_cloudsearch_domain" "test" {
--- FAIL: TestAccCloudSearchDomain_basic (31.01s)
FAIL

The ListDomainNames API can be used as the PreCheck.

% aws cloudsearch list-domain-names

An error occurred (NotAuthorized) when calling the ListDomainNames operation: New domain creation not supported on this account. Please reach out to AWS Support for assistance.

References

Relates https://github.com/hashicorp/terraform-provider-aws/pull/38509#issuecomment-2256587266

Would you like to implement a fix?

None

github-actions[bot] commented 3 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

github-actions[bot] commented 3 months ago

[!WARNING] This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

github-actions[bot] commented 3 months ago

This functionality has been released in v5.61.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. Thank you!

github-actions[bot] commented 2 months ago

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.