Skip to content

Commit

Permalink
[cli] Fix backend initialization
Browse files Browse the repository at this point in the history
Previously, the init command had a '-b' flag. This only initialized a
local backend but the description on the flag stated 'useful for
refreshing a pre-existing deployment'. This flag now actually reflects
this

Signed-off-by: jack1902 <39212456+jack1902@users.noreply.github.com>
  • Loading branch information
jack1902 committed Feb 25, 2020
1 parent 3460659 commit 77059c3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions streamalert_cli/terraform/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def handler(cls, options, config):

# Stop here if only initializing the backend
if options.backend:
return cls._terraform_init_backend()
return cls._terraform_init_backend(config)

LOGGER.info('Initializing StreamAlert')

Expand Down Expand Up @@ -113,7 +113,7 @@ def handler(cls, options, config):
return tf_runner(refresh=False)

@staticmethod
def _terraform_init_backend():
def _terraform_init_backend(config):
"""Initialize the infrastructure backend (S3) using Terraform
Returns:
Expand All @@ -127,6 +127,10 @@ def _terraform_init_backend():
if not terraform_check():
return False

# See generate_main() for how it uses the `init` kwarg for the local/remote backend
if not terraform_generate_handler(config=config, init=False):
return False

LOGGER.info('Initializing StreamAlert backend')
return run_command(['terraform', 'init'])

Expand Down

0 comments on commit 77059c3

Please sign in to comment.