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.61k stars 9k forks source link

[Enhancement]: Handling around the primary aws_athena_workgroup #37845

Open voidshard opened 4 weeks ago

voidshard commented 4 weeks ago

Description

Hi there,

AWS Athena includes a "primary" workgroup by default, which cannot be deleted. For what it is worth I suspect that this didn't used to be the case (?? unsure).

I believe if one wishes to manage configuration for the workgroup "primary" they're currently required to run a Terraform import command or embed an import block within their root. Both of these seem like substandard solutions. Rather I would argue that Terraform is incorrect to attempt to make a workgroup that we know ahead of time cannot be created, at least for current iterations of AWS (and into the foreseeable future?).

Error: creating Athena WorkGroup (primary): operation error Athena: CreateWorkGroup, https response error StatusCode: 400, RequestID: 2xxxf, InvalidRequestException: primary workGroup could not be created

Please correct me if there is something obvious I am missing!

Affected Resource(s) and/or Data Source(s)

aws_athena_workgroup

Potential Terraform Configuration

resource "aws_athena_workgroup" "example" {
  name = "primary"
  configuration {
    result_configuration {
      output_location = "s3://any_bucket/output/"
    }
  }
}

References

https://docs.aws.amazon.com/athena/latest/ug/user-created-workgroups.html By default, each account has a primary workgroup [..]. The primary workgroup cannot be deleted.

Would you like to implement a fix?

Yes

github-actions[bot] commented 4 weeks ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

justinretzolk commented 3 weeks ago

Possibly related #36621 and #36628

voidshard commented 3 weeks ago

I don't believe so. This is tf attempting to create the primary workgroup which is impossible by definition as primary always exists and cannot be removed.

tlorreyte commented 2 weeks ago

I agree with you @voidshard. #36628 is to allow a workgroup to be created even if the primary one is disabled by specifying another workgroup where to run the command.