Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Commit

Permalink
Showing 4 changed files with 1 addition and 185 deletions.
2 changes: 0 additions & 2 deletions terraform/main.tf
Original file line number Diff line number Diff line change
@@ -9,8 +9,6 @@ module "dynamodb" {
module "iam" {
source = "./modules/iam"
error_sns_topic = var.error_sns_topic
destiny_insights_mods_arn = module.dynamodb.destiny_insights_mods_arn
destiny_insights_xur_arn = module.dynamodb.destiny_insights_xur_arn
destiny_insights_items_arn = module.dynamodb.destiny_insights_items_arn
parameter_store_twitter_auth_arn = var.parameter_store_twitter_auth_arn
}
122 changes: 1 addition & 121 deletions terraform/modules/dynamodb/main.tf
Original file line number Diff line number Diff line change
@@ -1,119 +1,7 @@
resource "aws_dynamodb_table" "destiny_insights_mods" {
name = "destiny-insights-mods"
billing_mode = "PROVISIONED"
read_capacity = 15
write_capacity = 2
hash_key = "key"

point_in_time_recovery {
enabled = true
}

attribute {
name = "key"
type = "S"
}

attribute {
name = "timestamp"
type = "S"
}

attribute {
name = "type"
type = "S"
}

attribute {
name = "name"
type = "S"
}

global_secondary_index {
name = "timestamp"
hash_key = "timestamp"
write_capacity = 2
read_capacity = 2
projection_type = "ALL"
}

global_secondary_index {
name = "type"
hash_key = "type"
write_capacity = 2
read_capacity = 2
projection_type = "ALL"
}

global_secondary_index {
name = "name"
hash_key = "name"
write_capacity = 2
read_capacity = 2
projection_type = "ALL"
}
}

resource "aws_dynamodb_table" "destiny_insights_xur" {
name = "destiny-insights-xur"
billing_mode = "PROVISIONED"
read_capacity = 2
write_capacity = 2
hash_key = "key"

point_in_time_recovery {
enabled = true
}

attribute {
name = "key"
type = "S"
}

attribute {
name = "timestamp"
type = "S"
}

attribute {
name = "type"
type = "S"
}

attribute {
name = "name"
type = "S"
}

global_secondary_index {
name = "timestamp"
hash_key = "timestamp"
write_capacity = 2
read_capacity = 2
projection_type = "ALL"
}

global_secondary_index {
name = "type"
hash_key = "type"
write_capacity = 2
read_capacity = 2
projection_type = "ALL"
}

global_secondary_index {
name = "name"
hash_key = "name"
write_capacity = 2
read_capacity = 2
projection_type = "ALL"
}
}

resource "aws_dynamodb_table" "destiny_insights_items" {
name = "destiny-insights-items"
billing_mode = "PROVISIONED"
read_capacity = 20
read_capacity = 35
write_capacity = 2
hash_key = "key"

@@ -196,14 +84,6 @@ resource "aws_dynamodb_table" "destiny_insights_items" {
}
}

output "destiny_insights_mods_arn" {
value = aws_dynamodb_table.destiny_insights_mods.arn
}

output "destiny_insights_xur_arn" {
value = aws_dynamodb_table.destiny_insights_xur.arn
}

output "destiny_insights_items_arn" {
value = aws_dynamodb_table.destiny_insights_items.arn
}
52 changes: 0 additions & 52 deletions terraform/modules/iam/main.tf
Original file line number Diff line number Diff line change
@@ -91,58 +91,6 @@ resource "aws_iam_role_policy_attachment" "attach_parameter_store" {
policy_arn = aws_iam_policy.destiny_insights_bot_parameter_store.arn
}

resource "aws_iam_policy" "destiny_insights_mods" {
name = "destiny-insights-mods-dynamodb"
description = "Adds DynamoDB access"

policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"dynamodb:Scan",
"dynamodb:PutItem"
],
"Resource": "${var.destiny_insights_mods_arn}"
}
]
}
EOF
}

resource "aws_iam_role_policy_attachment" "attach_destiny_insights_mods_dynamodb" {
role = aws_iam_role.destiny_insights_bot.name
policy_arn = aws_iam_policy.destiny_insights_mods.arn
}

resource "aws_iam_policy" "destiny_insights_xur" {
name = "destiny-insights-xur-dynamodb"
description = "Adds DynamoDB access"

policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"dynamodb:Scan",
"dynamodb:PutItem"
],
"Resource": "${var.destiny_insights_xur_arn}"
}
]
}
EOF
}

resource "aws_iam_role_policy_attachment" "attach_destiny_insights_xur_dynamodb" {
role = aws_iam_role.destiny_insights_bot.name
policy_arn = aws_iam_policy.destiny_insights_xur.arn
}

resource "aws_iam_policy" "destiny_insights_items" {
name = "destiny-insights-items-dynamodb"
description = "Adds DynamoDB access"
10 changes: 0 additions & 10 deletions terraform/modules/iam/variables.tf
Original file line number Diff line number Diff line change
@@ -8,16 +8,6 @@ variable "parameter_store_twitter_auth_arn" {
type = string
}

variable "destiny_insights_mods_arn" {
description = "DynamoDB destiny_insights_mods table ARN"
type = string
}

variable "destiny_insights_xur_arn" {
description = "DynamoDB destiny_insights_xur table ARN"
type = string
}

variable "destiny_insights_items_arn" {
description = "DynamoDB destiny_insights_items table ARN"
type = string

0 comments on commit 176dd62

Please sign in to comment.