layer0
layer0 copied to clipboard
l0-setup: AccessDenied error when finishing 'apply'
Expected behavior
Running l0-setup apply [instance] should complete without error.
Actual behavior
The end of the apply workflow incorporates the push workflow in order to backup the terraform files to S3. However, that apply doesn't seem to have access to the newly-created instance's credentials, so the push fails with AccessDenied. Using l0-setup endpoint to put the credentials into the environment and then re-running the same apply will then succeed, because apply will have access to those creds in the env vars.
Steps to reproduce the behavior
-
l0-setup apply [new-instance]and watch it fail at the end. -
eval $( l0-setup endpoint -d -i [new-instance] | sed -n '1!p' )to get env vars. -
l0-setup apply [new-instance]and watch it succeed because of env vars.
Thoughts on how to proceed
The issue stems from an attempt to consolidate two commands into one without the prereq's for one of those commands. I have a couple of suggestions up front:
- Fully separate the
pushworkflow from theapplyworkflow. This makes the backing up of a layer0 instance's terraform files a responsibility of the user. - Incorporate the
endpointworkflow into theapplyworkflow as well, so that whenpushis executed, it has the required credentials in the environment.