hey folks, how can I get an s3 backend configured ...
# geodesic
c
hey folks, how can I get an s3 backend configured using atmos? My stack file looks like the following. I do not have a provider or a terraform block defined in the tf files.
e
Just run:
Copy code
atmos terraform backend generate component tfstate-backend --stack ue1-root
replace
tfstate-backend
with the name of your component
run that for every component
we commit the
backend.tf.json
file to VCS
---
also, remember you can always run:
Copy code
atmos terraform help
for a list of commands
c
beautiful, i knew there had to be something i was missing. Thanks Erik!
💯 1
@Erik Osterman (Cloud Posse) you run a backend generate for every environment everytime you want to switch from dev to staging for example?
i want to work on vpc dev, ok i run generate, have it write to the component directory. now i want to promote to staging, so i have to generate/copy a new backend config?
e
Nope. We never need the generate the file again. We use the workspace to separate environments.
c
ok, i see the way the tfstate is structured, so you just change the key in each components s3 backend configuration
✅ 1
and the bucket is essentially namespaced by the environment/stack
thanks again, no need to respond if my above findings are correct, I know you're busy and i think i've got this all figured. vendir and variant are awesome, and your guys wrapping them into geodesic makes quite a useful tool!
e
you got it
c
beauty, yeah i've actually got all this going fine now, thanks again for your help !
my components and my stacks are now in their own repo's, they are brought into the container by vendir. each time i make a change i just commit to their repo's and do vendir sync to bring the latest in
e
when you rerun vendir, though, doesn't it want to delete the backend file?
c
the backends are committed to their repo's
the backend.tf.json
and they're all s3 backed, just to be explicit