I'm currently using Atmos for managing our infrast...
# atmos
n
I'm currently using Atmos for managing our infrastructure as code. I have a catalog component named
eks-ops
which provisions the EKS cluster and its associated components. Over time, the name
eks-ops
has caused some confusion—especially with regard to associating it with an "ops" AWS account, even though it’s used for all our environments, including
dev
. Now that we’re still early in our rollout (with only dev environments deployed), I’d like to take the opportunity to rename the component from
eks-ops
to simply
eks
, which is more intuitive and aligned with the standard naming convention. Here’s what I’ve done so far: 1. Created a copy of the
catalog/eks-ops
folder and renamed it to
catalog/eks
, cleaning up all
eks-ops
references in the manifest YAMLs. 2. Followed the Atmos component migration tutorial to migrate Terraform state from the old component name to the new one. Steps taken:
Copy code
cd components/terraform/eks/cluster/
terraform init
terraform workspace list
terraform workspace new plat-use1-dev-eks-cluster
terraform workspace select plat-use1-dev-eks-cluster
terraform state pull > plat-use1-dev-eks.tfstate
terraform state push plat-use1-dev-eks.tfstate
Additionally, I compared the state between the two workspaces:
Copy code
terraform workspace select plat-use1-dev-eks-cluster
terraform state list

terraform workspace select plat-use1-dev-eks-cluster-ops
terraform state list
The resource lists in both workspaces are identical, confirming no drift. However, when I run:
Copy code
atmos terraform plan eks/cluster --stack plat-use1-dev
The plan still shows all 54 EKS-related resources as if they are going to be recreated. My Question: Is there a supported way to change a catalog component name (in this case, from
eks-ops
to
eks
) in Atmos without causing Terraform to interpret it as a new component and attempt to recreate all the associated infrastructure? I'm assuming this has something to do with the backend configuration or how the component identity is derived, but I couldn’t find specific guidance on how to remap the state to avoid a full re-creation. Any insight into what I might be missing—or a recommended process to cleanly rename components without destroying and recreating resources—would be greatly appreciated.
a
in terms of Terraform workspaces and backends, you usually deal with 2 parameters: •
terraform_workspace
(https://atmos.tools/core-concepts/components/terraform/workspaces) •
workspace_key_prefix
(https://atmos.tools/core-concepts/components/terraform/backends/#aws-s3-backend)
when you have a component
eks-ops
in a stack
use1-dev
, Atmos/Terraform do the following:
• for
workspace_key_prefix
, the component name is used automatically (unless you override it by manually specifying
workspace_key_prefix
for the component. In your case,
eks-ops
were used • for
terraform_workspace
, the stack name is used automatically (unless you override it https://atmos.tools/core-concepts/components/terraform/workspaces#terraform-workspace-override-in-atmos), in your case it's
use1-dev
if you want to rename an Atmos component (e.g., from
eks-ops
to
eks
), you can: • Move the TF state from one backend location to the other (as you did above) • Or, rename the component and configure it to keep the same
workspace_key_prefix
(so terraform will not attempt to move the state and will use the existing one)
if you want the second option (keep the already provisioned resources w/o moving the state or recreating them), you need to do the following:
• Override the TF workspace to use the existing one
Copy code
components:
  terraform:
    eks:
      metadata:
        component: eks/cluster
        # Override Terraform workspace using the pattern
        terraform_workspace_pattern: "{environment}-{stage}-eks-ops"
• Override
workspace_key_prefix
for the component (The
workspace_key_prefix
in the Terraform S3 backend configuration is an optional parameter that defines a prefix applied to the state file keys within the S3 bucket when using Terraform workspaces) s3://my-terraform-state-bucket/<workspace_key_prefix/workspace/terraform.tfstate
Copy code
components:
  terraform:
    eks:
      backend:
        s3:
          workspace_key_prefix: eks-ops
so if you want to keep the existing resources and Tf workspace w/o recreating everything, the final component config should look like this:
Copy code
components:
  terraform:
    eks:
      metadata:
        component: eks/cluster
        # Override Terraform workspace using the pattern
        terraform_workspace_pattern: "{environment}-{stage}-eks-ops"
      backend:
        s3:
          workspace_key_prefix: eks-ops
if you go this route, let me know how it goes
n
@Andriy Knysh (Cloud Posse) Sorry for the delayed response. I couldn't get the time to look at this for last couple of days. but thank you for the your feedback and it worked. I did migrate state file from one workspace to another and I didn't specify any particular workspace, instead I pushed state to default workspace which was atmos/terraform choosing.