atmos
atmos copied to clipboard
Add workspace_key_prefix prefix to use an existing s3 tfstate bucket
Describe the Feature
I'd like to use an existing s3 bucket for tfstate for an atmos poc without cluttering up the s3 bucket's root space.
Preferably, i'd like to add a workspace_key_prefix
of atmos/
before the component name
Expected Behavior
Everything is in root space
$ aws s3 ls s3://some-tfstate-bucket/
PRE ecr/ # from atmos
PRE hello-world/ # from atmos
PRE existing/
PRE # ...
Use Case
See above
Describe Ideal Solution
Add prefix for workspace prefix such as workspace_key_prefix_prefix
or workspace_directory
Alternatives Considered
Create a new bucket
Additional Context
No response
workspace_key_prefix
can be specified per component, e.g.
components:
terraform:
vpc:
backend:
s3:
workspace_key_prefix: "my-vpc"
If not specified, then Atmos generates it automatically using the Atmos component name.
In the above case, if you don't use workspace_key_prefix: "my-vpc"
, then it will be set to vpc
(Atmos component name).
And since the backend
section participates in all the inheritance and deep-merging, you can specify workspace_key_prefix
in any of the base abstract components, in a mixin, or any other config that would be applied to the component in question
@nitrocode is this what you are asking?
Hi @aknysh , it's similar. I want the workspace_key_prefix
to be prefixed with another hard coded value which at the moment atmos does not support.
For example, a workspace_key_prefix
equal to my <component>
will give me this in my S3 bucket.
s3://tfstate-bucket/<component>
What I want is to prefix the workspace_key_prefix
with a root level directory
s3://tfstate-bucket/<root-level-directory>/<component>
e.g.
components:
terraform:
vpc:
backend:
s3:
workspace_key_prefix: "vpc"
workspace_key_prefix_prefix: "atmos/"
which should result in this
s3://tfstate-bucket/atmos/vpc
I don't want to do it on a per-component level (like in the example above) but on a global level where I define all my bucket information.