Skip to content

Auto State Bucket Creation is Failing #116

@ephur

Description

@ephur

When specifying a state bucket that does not exist, the worker will attempt to automatically create it (when --create-backend-bucket is specified, which is the default value; though consider flipping the default).

A stack trace is generated, this was likely never tested properly after refactoring the backend handlers, and removing this functionality from the authenticator to the handler.

Traceback (most recent call last):
  File "/Users/ephur/.pyenv/versions/sigilstack-bootstrap/bin/worker", line 8, in <module>
    sys.exit(cli())
             ~~~^^
  File "/Users/ephur/.pyenv/versions/3.13.3/envs/sigilstack-bootstrap/lib/python3.13/site-packages/click/core.py", line 1442, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/ephur/.pyenv/versions/3.13.3/envs/sigilstack-bootstrap/lib/python3.13/site-packages/click/core.py", line 1363, in main
    rv = self.invoke(ctx)
  File "/Users/ephur/.pyenv/versions/3.13.3/envs/sigilstack-bootstrap/lib/python3.13/site-packages/click/core.py", line 1830, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/Users/ephur/.pyenv/versions/3.13.3/envs/sigilstack-bootstrap/lib/python3.13/site-packages/click/core.py", line 1226, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ephur/.pyenv/versions/3.13.3/envs/sigilstack-bootstrap/lib/python3.13/site-packages/click/core.py", line 794, in invoke
    return callback(*args, **kwargs)
  File "/Users/ephur/.pyenv/versions/3.13.3/envs/sigilstack-bootstrap/lib/python3.13/site-packages/click/decorators.py", line 34, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/ephur/.pyenv/versions/3.13.3/envs/sigilstack-bootstrap/lib/python3.13/site-packages/tfworker/cli.py", line 100, in terraform
    tfc = TerraformCommand(deployment=deployment)
  File "/Users/ephur/.pyenv/versions/3.13.3/envs/sigilstack-bootstrap/lib/python3.13/site-packages/tfworker/commands/base.py", line 71, in __init__
    self._app_state.backend = _init_backend_(self._app_state)
                              ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/ephur/.pyenv/versions/3.13.3/envs/sigilstack-bootstrap/lib/python3.13/site-packages/tfworker/commands/base.py", line 186, in _init_backend_
    be = _select_backend(
        backend_config,
        app_state.deployment,
        app_state.authenticators,
    )
  File "/Users/ephur/.pyenv/versions/3.13.3/envs/sigilstack-bootstrap/lib/python3.13/site-packages/tfworker/commands/base.py", line 217, in _select_backend
    return backend.value(authenticators, deployment=deployment)
           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ephur/.pyenv/versions/3.13.3/envs/sigilstack-bootstrap/lib/python3.13/site-packages/tfworker/backends/s3.py", line 78, in __init__
    self._ensure_backend_bucket()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/ephur/.pyenv/versions/3.13.3/envs/sigilstack-bootstrap/lib/python3.13/site-packages/tfworker/backends/s3.py", line 439, in _ensure_backend_bucket
    self._create_bucket(self._authenticator.bucket)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'AWSAuthenticator' object has no attribute 'bucket'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions