2

I am currently using Spacelift and on my stack, the state is managed by Spacelift.

I am happy with this but I want to export the state to an Amazon S3 bucket, is there any way to do this?

1 Answer 1

2

The Terraform state file can be pulled and then exported using a Task.

For example, to export the state to an Amazon S3 bucket, you would run the following command as a Task:

terraform state pull > state.json && aws s3 cp state.json s3://

For that example to work, the stack needs to have write access to the AWS S3 bucket, possibly via an AWS Integration.

You could also set up a hook to constantly run this command at a specific part of your run.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.