Jonathan Rose
03/23/2026, 6:40 PMvars:
labels_as_tags: []
label_value_case: none
regex_replace_chars: "/[^a-zA-Z0-9\\s-]/"
Terraform has been successfully initialized!
Switched to workspace "cfsb-aws-org-units".
aws_organizations_organizational_unit.this[0]: Preparing import... [id=ou-8wia-m8s04a9h]
aws_organizations_organizational_unit.this[0]: Refreshing state... [id=ou-8wia-m8s04a9h]
Normally, I would expect the workspace to be formatted as {{ .atmos_stacks }}-{{ .atmos_components}}Charles Smith
03/23/2026, 7:00 PMatmos decides that the workspace_key_prefix is derived which then decides where the state is in the bucket:
https://atmos.tools/design-patterns/version-management/folder-based-versioning#how-atmos-calculates-workspace_key_prefix
If you actually set workspace_key_prefix to something static in your top level backend.s3 then it would actually be the same state file for all (which would not be good).
But based on these docs if you do not define workspace_key_prefix then it should default to the component name (and then the actual workspace is a dir under that).Jonathan Rose
03/23/2026, 8:04 PMaws/account:
backend_type: s3
backend:
s3:
acl: "bucket-owner-full-control"
encrypt: true
key: "{{ .atmos_stack}}-{{ .atmos_component }}.tfstate"
region: "us-east-1"
use_lockfile: true
workspace_key_prefix: "account-factory"
It still reuses the workspace, but at least the value of key ensures nothing is overwrittenCharles Smith
03/23/2026, 8:19 PMworkspace_key_prefix in the above config, then do a plan and then look in the generated backend.tf.json file you don't see it using the component name for the workspace_key_prefix ?Jonathan Rose
03/23/2026, 8:23 PMJonathan Rose
03/23/2026, 8:23 PMimport:
- mixins/providers/aws
components:
terraform:
aws/account:
backend_type: s3
backend:
s3:
acl: "bucket-owner-full-control"
encrypt: true
key: "terraform.tfstate"
region: "us-east-1"
use_lockfile: true
workspace_key_prefix: "account-factory"
metadata:
type: abstract
component: '{{ .atmos_component }}'
name: '{{ .atmos_component }}'
source:
uri: <http://github.com/cloudposse-terraform-components/aws-account//src|github.com/cloudposse-terraform-components/aws-account//src>
version: v2.0.0
vars:
enabled: true
region: us-east-1Jonathan Rose
03/23/2026, 8:23 PMJonathan Rose
03/23/2026, 8:54 PMAndriy Knysh (Cloud Posse)
03/23/2026, 9:02 PMAndriy Knysh (Cloud Posse)
03/23/2026, 9:03 PMcomponents:
terraform:
# Atmos component `vpc/1`
vpc/1:
metadata:
# Point to the Terraform component in `components/terraform/vpc`
component: vpc
# Inherit the defaults for all VPC components
inherits:
- vpc/defaults
# Define/override variables specific to this `vpc/1` component
vars:
name: vpc-1
ipv4_primary_cidr_block: 10.9.0.0/18
# Atmos component `vpc/2`
vpc/2:
metadata:
# Point to the Terraform component in `components/terraform/vpc`
component: vpc
# Inherit the defaults for all VPC components
inherits:
- vpc/defaults
# Define/override variables specific to this `vpc/2` component
vars:
name: vpc-2
ipv4_primary_cidr_block: 10.10.0.0/18
map_public_ip_on_launch: falseAndriy Knysh (Cloud Posse)
03/23/2026, 9:05 PM