[release-3-0-0] Error when running terraform init
jack1902 opened this issue · 0 comments
jack1902 commented
Background
Currently trying to initialize the infrastructure through terraform
via ./manage.py init
and i am running into the following error
Description
stacktrace: error.txt
Copy and paste the error here for the convenience.
Error: Invalid count argument
on modules/tf_rules_engine/iam.tf line 27, in resource "aws_iam_role_policy" "read_rules_table":
27: count = var.rules_table_arn == "" ? 0 : 1
The "count" value depends on resource attributes that cannot be determined
until apply, so Terraform cannot predict how many instances will be created.
To work around this, use the -target argument to first apply only the
resources that the count depends on.
[ERROR 2020-01-14 16:25:46,960 (streamalert_cli.helpers:68)]: An error occurred while running: terraform apply -refresh=true -auto-approve=false -target=module.classifier_prod_lambda -target=module.alert_merger_lambda -target=module.alert_processor_lambda -target=module.rules_engine_iam -target=module.streamalert_athena -target=module.classifier_prod_iam -target=module.alert_merger_iam -target=module.alert_processor_iam -target=module.rules_engine_lambda
['terraform', 'apply', '-refresh=true', '-auto-approve=false', '-target=module.classifier_prod_lambda', '-target=module.alert_merger_lambda', '-target=module.alert_processor_lambda', '-target=module.rules_engine_iam', '-target=module.streamalert_athena', '-target=module.classifier_prod_iam', '-target=module.alert_merger_iam', '-target=module.alert_processor_iam', '-target=module.rules_engine_lambda']
Traceback (most recent call last):
File "./manage.py", line 116, in <module>
main()
File "./manage.py", line 112, in main
sys.exit(not cli_runner(options))
File "/Users/USER/personal/github/streamalert/streamalert_cli/runner.py", line 70, in cli_runner
result = cmds[args.command](args)
File "/Users/USER/personal/github/streamalert/streamalert_cli/runner.py", line 126, in <lambda>
command: lambda opts, cmd=cli_command: cmd.handler(opts, config)
File "/Users/USER/personal/github/streamalert/streamalert_cli/terraform/handlers.py", line 116, in handler
create_table('alerts', alerts_bucket, config)
File "/Users/USER/personal/github/streamalert/streamalert_cli/athena/handler.py", line 367, in create_table
if athena_client.check_table_exists(sanitized_table_name):
File "/Users/USER/personal/github/streamalert/streamalert/shared/athena.py", line 310, in check_table_exists
result = self.run_query_for_results('SHOW TABLES LIKE \'{}\';'.format(table_name))
File "/Users/USER/personal/github/streamalert/streamalert/shared/athena.py", line 285, in run_query_for_results
execution_id = self._execute_and_wait(query)
File "/Users/USER/personal/github/streamalert/streamalert/shared/athena.py", line 106, in _execute_and_wait
self.check_query_status(execution_id)
File "/Users/USER/personal/github/streamalert/streamalert/shared/athena.py", line 218, in check_query_status
'Query \'{}\' {} with reason \'{}\', exiting'.format(execution_id, state, reason)
streamalert.shared.athena.AthenaQueryExecutionError: Query 'QUERY_ID (scrubbed)' FAILED with reason 'FAILED: SemanticException [Error 10072]: Database does not exist: (removed_prefix_but_that_goes_here)_streamalert', exiting
Steps to Reproduce
git clone git@github.com:airbnb/streamalert.git
git checkout -b release-3-0-0
- follow initial setup (venv, prefix, account_id)
- run
./manage.py init