STATUS: In proposal
When Terragrunt creates a DynamoDB table, it sets the throughput to the default,
PROVISIONED
. Provisioned is good for stable throughput, but Terraform largely
works with variable workloads, often going unused.
AWS also offers a PAY_PER_REQUEST
billing mode that charges based on the
number of requests to the lock table. The pricing is dirt cheap, and it will
further reduce the costs associated with using Terragrunt to manage Terraform’s
base requirements.
Terraform has solved this problem: It involves creating and managing the resource manually. But, if Terragrunt is going to be managing the table, it should allow for additional configuration to be layered on top of it via Terragrunt.
dynamodb_table_config
block in remote_state.config
Because our company has a need for it, I’ve implemented a solution in my own fork that accomplishes this.
https://github.com/ThatGerber/terragrunt/tree/add-dynamodb-billing-mode
The dynamodb_table_config
block accepts several arguments that are forwarded
through to the DynamoTableInput object, pulling in additional values from the
parent config as defaults.
To receive the full values, I had to write a few interfaces for the methods
being called (like GetLockTableName
) and change the function calls to accept
the interfaces instead of strings.
dynamodb_table_config
block that populates dynamodb.CreateTableInput
structAnother option is to create a config attribute that accepts any arguments that
would be sent to CreateTable
or UpdateTable
map the values through to the
methods when they’re being applied.