I’m getting error when use dynamodb_table and kms_key_id attributes in aws S3 backend.
backend.rb
backend("s3",
bucket: ENV['TF_S3_BUCKET'],
key: ":ENV/:REGION/customers/:INSTANCE/:MOD_NAME/terraform.tfstate",
region: ":REGION",
encrypt: true,
dynamodb_table: ENV['TF_LOCK_TABLE'],
acl: "private",
kms_key_id: ENV['TF_S3_KMS_KEY_ID'],
skip_credentials_validation: true,
skip_region_validation: true,
skip_metadata_api_check: true
)
Error:
Error evaluating /app/config/terraform/backend.rb:
undefined method `aws' for #<TerraspacePluginAws::Interfaces::Expander:0x00005610ce2d9530>
Here's the line in /app/config/terraform/backend.rb with the error:
1 backend("s3",
2 bucket: ENV['TF_S3_BUCKET'],
3 key: ":ENV/:REGION/customers/:INSTANCE/:MOD_NAME/terraform.tfstate",
4 region: ":REGION",
5 encrypt: true,
6 dynamodb_table: ENV['TF_LOCK_TABLE'],
Full error:
bundler: failed to load command: terraspace (/usr/local/bundle/bin/terraspace)
NoMethodError: undefined method `aws' for #<TerraspacePluginAws::Interfaces::Expander:0x00005610ce2d9530>
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/plugin/expander/interface.rb:72:in `var_value'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/plugin/expander/interface.rb:41:in `block in expansion'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/plugin/expander/interface.rb:40:in `each'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/plugin/expander/interface.rb:40:in `expansion'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/plugin/expander/interface.rb:22:in `block in expand'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/plugin/expander/interface.rb:21:in `each'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/plugin/expander/interface.rb:21:in `expand'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/compiler/expander.rb:3:in `expand'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/compiler/dsl/syntax/mod/backend.rb:11:in `expansion_all!'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/compiler/dsl/syntax/mod/backend.rb:6:in `backend'
/app/config/terraform/backend.rb:1:in `evaluate_file'
/usr/local/bundle/gems/dsl_evaluator-0.1.3/lib/dsl_evaluator.rb:11:in `instance_eval'
/usr/local/bundle/gems/dsl_evaluator-0.1.3/lib/dsl_evaluator.rb:11:in `evaluate_file'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/compiler/dsl/mod.rb:13:in `evaluate'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/compiler/dsl/mod.rb:8:in `build'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/compiler/strategy/mod/rb.rb:4:in `run'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/compiler/strategy/mod.rb:8:in `run'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/compiler/cleaner/backend_change.rb:40:in `fresh_backend'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/compiler/cleaner/backend_change.rb:21:in `purge?'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/compiler/cleaner/backend_change.rb:10:in `purge'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/compiler/cleaner.rb:16:in `backend_change_purge'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/compiler/cleaner.rb:9:in `clean'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/builder.rb:77:in `clean'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/builder.rb:13:in `run'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/cli/up.rb:20:in `build'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/cli/up.rb:8:in `run'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/cli.rb:222:in `up'
/usr/local/bundle/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
/usr/local/bundle/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/bundle/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
/usr/local/bundle/gems/terraspace-0.6.19/lib/terraspace/command.rb:61:in `dispatch'
/usr/local/bundle/gems/thor-1.1.0/lib/thor/base.rb:485:in `start'
/usr/local/bundle/gems/terraspace-0.6.19/exe/terraspace:14:in `<top (required)>'
/usr/local/bundle/bin/terraspace:23:in `load'
/usr/local/bundle/bin/terraspace:23:in `<top (required)>'
/app #
if i command the dynamodb table and kms key id, runs well.
Could you help?
Thanks.
Regards,
Fábio Santos