Skip to content

Commit

Permalink
Add dynamodb (#85)
Browse files Browse the repository at this point in the history
* Add `dynamodb`

* Add `dynamodb`

* Add `dynamodb`

* Add `dynamodb`

* Add `dynamodb`

* Add `dynamodb`

* Add `dynamodb`
  • Loading branch information
aknysh authored Jan 11, 2020
1 parent 0b2446a commit 74f673d
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 8 deletions.
10 changes: 2 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
FROM cloudposse/helmfiles:0.8.6 as helmfiles

FROM cloudposse/geodesic:0.123.0
FROM cloudposse/geodesic:0.123.1

ENV DOCKER_IMAGE="cloudposse/testing.cloudposse.co"
ENV DOCKER_TAG="latest"
Expand Down Expand Up @@ -44,11 +42,7 @@ RUN apk add terraform_0.12@cloudposse terraform@cloudposse==0.12.10-r0
RUN apk add helm@cloudposse==2.14.3-r0

# Pin helmfile to 0.81.0 for stability
RUN apk update && apk add helmfile@cloudposse==0.82.0-r0

# Copy helmfiles
COPY --from=helmfiles /helmfile.d/ /conf/helmfile.d/
COPY --from=helmfiles /scripts/ /conf/scripts/
RUN apk update && apk add helmfile@cloudposse==0.94.1-r0

# Place configuration in 'conf/' directory
COPY conf/ /conf/
Expand Down
15 changes: 15 additions & 0 deletions atlantis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,21 @@ projects:
apply_requirements:
- "approved"

- name: "dynamodb"
workflow: "make"
dir: "conf/dynamodb"
workspace: "default"
terraform_version: "v0.12.10"
autoplan:
when_modified:
- "Makefile*"
- "*.tf"
- "*.tfvars"
- ".envrc"
enabled: true
apply_requirements:
- "approved"

workflows:
make:
plan:
Expand Down
5 changes: 5 additions & 0 deletions conf/dynamodb/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source_up
use envrc
use terraform 0.12
use atlantis
use tfenv
9 changes: 9 additions & 0 deletions conf/dynamodb/Makefile.tasks
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-include ${TF_MODULE_CACHE}/Makefile

deps:
mkdir -p ${TF_MODULE_CACHE}
terraform init

## Reset this project
reset:
rm -rf ${TF_MODULE_CACHE} .terraform
6 changes: 6 additions & 0 deletions conf/dynamodb/terraform.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export TF_MODULE_CACHE=.module

# Import the remote module
export TF_CLI_INIT_FROM_MODULE="git::https://github.com/cloudposse/terraform-root-modules.git//aws/dynamodb?ref=tags/0.115.0"

export TF_CLI_PLAN_PARALLELISM=2
87 changes: 87 additions & 0 deletions conf/dynamodb/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name = "trader-page-stats"

billing_mode = "PAY_PER_REQUEST"

hash_key = "trader_id"

hash_key_type = "N"

range_key = "ds"

range_key_type = "S"

ttl_attribute = ""

dynamodb_attributes = []

# Specify additional attributes only if they are part of local or global secondary indexes
# Otherwise, the error "All attributes must be indexed. Unused attributes: ..." will be thrown
# See https://stackoverflow.com/questions/50006885/terraform-dynamodb-all-attributes-must-be-indexed
#dynamodb_attributes = [
# {
# name = "lookup_count"
# type = "N"
# },
# {
# name = "search_count"
# type = "N"
# },
# {
# name = "external_count"
# type = "N"
# },
# {
# name = "total_count"
# type = "N"
# },
# {
# name = "site"
# type = "N"
# }
#]

global_secondary_index_map = []

local_secondary_index_map = []

chamber_parameters_enabled = false

dynamodb_chamber_service = "dynamodb"

enable_streams = false

stream_view_type = ""

enable_encryption = true

enable_point_in_time_recovery = true

enable_backup = true

backup_kms_key_arn = ""

backup_schedule = "cron(0 12 * * ? *)"

backup_start_window = 60

backup_completion_window = 120

backup_cold_storage_after = 180

backup_delete_after = 360

# If billing_mode = "PAY_PER_REQUEST", autoscaling is not supported (setting `enable_autoscaler` to `true` has no effect).
# In billing_mode = "PAY_PER_REQUEST", AWS scales the table automatically
enable_autoscaler = false

autoscale_write_target = 50

autoscale_read_target = 50

autoscale_min_read_capacity = 5

autoscale_max_read_capacity = 20

autoscale_min_write_capacity = 5

autoscale_max_write_capacity = 20

0 comments on commit 74f673d

Please sign in to comment.