Terraform not managing the correct version of AWS EKS due to conflicting provider configurations
I've looked through the documentation and I'm still confused about I'm working with an scenario while trying to manage an AWS EKS cluster with Terraform... I have multiple environments defined using different Terraform workspaces, but when I switch between them, I notice that the provider configuration does not seem to update correctly, causing unexpected behavior. For example, I have the following provider configuration: ```hcl provider "aws" { region = var.aws_region version = "~> 3.0" assume_role { role_arn = "${var.role_arn}" } } ``` And I'm using the following resources for the EKS cluster: ```hcl resource "aws_eks_cluster" "my_cluster" { name = "my-cluster-${terraform.workspace}" role_arn = aws_iam_role.eks_role.arn vpc_config { subnet_ids = aws_subnet.eks_subnets[*].id } } ``` When I switch to a different workspace and run `terraform apply`, I expect the EKS cluster configuration to reflect the changes for that environment. However, I keep getting the behavior: ``` behavior: InvalidParameterException: The EKS cluster "my-cluster-dev" already exists. ``` I've confirmed that I am indeed in the correct workspace, as shown by running `terraform workspace show`. I've also tried to manually destroy the cluster using `aws eks delete-cluster --name my-cluster-dev`, but I still receive the same behavior when applying the configuration again. I suspect this might be related to state management or the way I'm handling multiple workspaces in conjunction with the provider configuration. I've checked my backend configuration and it uses S3 with DynamoDB for locking: ```hcl terraform { backend "s3" { bucket = "my-terraform-state" key = "eks/${terraform.workspace}.tfstate" region = "us-west-2" dynamodb_table = "terraform-locks" } } ``` Could anyone provide insights on how to ensure that the correct EKS cluster is managed per workspace, or if there's a best practice that I might be missing? Thanks in advance! Am I missing something obvious? I've been using Hcl for about a year now. What's the correct way to implement this?