layer0 icon indicating copy to clipboard operation
layer0 copied to clipboard

l0-setup: AccessDenied error when finishing 'apply'

Open tlake opened this issue 7 years ago • 0 comments

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 push workflow from the apply workflow. This makes the backing up of a layer0 instance's terraform files a responsibility of the user.
  • Incorporate the endpoint workflow into the apply workflow as well, so that when push is executed, it has the required credentials in the environment.

tlake avatar Apr 24 '18 19:04 tlake