From 17deabf937ebfb3a724de487233dc988001f864b Mon Sep 17 00:00:00 2001 From: Matt Jarrett <16245634+cujarrett@users.noreply.github.com> Date: Fri, 8 Oct 2021 15:28:53 -0500 Subject: [PATCH] feat: adds default terraform tags (#181) --- terraform/main.tf | 4 ---- terraform/modules/dynamodb/main.tf | 8 ------- terraform/modules/dynamodb/variables.tf | 4 ---- terraform/modules/event_bridge/main.tf | 4 ---- terraform/modules/event_bridge/variables.tf | 4 ---- terraform/modules/iam/main.tf | 24 --------------------- terraform/modules/iam/variables.tf | 5 ----- terraform/modules/lambda/main.tf | 4 ---- terraform/modules/lambda/variables.tf | 5 ----- terraform/provider.tf | 6 ++++++ terraform/variables.tf | 6 ------ 11 files changed, 6 insertions(+), 68 deletions(-) delete mode 100644 terraform/modules/dynamodb/variables.tf delete mode 100644 terraform/modules/event_bridge/variables.tf diff --git a/terraform/main.tf b/terraform/main.tf index 96c9212..91798f9 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -4,12 +4,10 @@ module "archive" { module "dynamodb" { source = "./modules/dynamodb" - app_name = var.app_name } module "iam" { source = "./modules/iam" - app_name = var.app_name 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 @@ -18,12 +16,10 @@ module "iam" { module "event_bridge" { source = "./modules/event_bridge" - app_name = var.app_name } module "lambda" { source = "./modules/lambda" - app_name = var.app_name error_sns_topic = var.error_sns_topic data_archive_file_placeholder_output_path = module.archive.data_archive_file_placeholder_output_path aws_iam_role_destiny_insights_bot_arn = module.iam.aws_iam_role_destiny_insights_bot_arn diff --git a/terraform/modules/dynamodb/main.tf b/terraform/modules/dynamodb/main.tf index 7b577d5..3c43baf 100644 --- a/terraform/modules/dynamodb/main.tf +++ b/terraform/modules/dynamodb/main.tf @@ -56,10 +56,6 @@ resource "aws_dynamodb_table" "destiny_insights_mods" { lifecycle { prevent_destroy = true } - - tags = { - app = var.app_name - } } resource "aws_dynamodb_table" "destiny_insights_xur" { @@ -120,10 +116,6 @@ resource "aws_dynamodb_table" "destiny_insights_xur" { lifecycle { prevent_destroy = true } - - tags = { - app = var.app_name - } } output "destiny_insights_mods_arn" { diff --git a/terraform/modules/dynamodb/variables.tf b/terraform/modules/dynamodb/variables.tf deleted file mode 100644 index cdf10d6..0000000 --- a/terraform/modules/dynamodb/variables.tf +++ /dev/null @@ -1,4 +0,0 @@ -variable "app_name" { - description = "app name" - type = string -} diff --git a/terraform/modules/event_bridge/main.tf b/terraform/modules/event_bridge/main.tf index fdcf11e..15cd0ab 100644 --- a/terraform/modules/event_bridge/main.tf +++ b/terraform/modules/event_bridge/main.tf @@ -2,10 +2,6 @@ resource "aws_cloudwatch_event_rule" "check_after_destiny_reset" { name = "check-after-destiny-reset" description = "Fires daily every five mins after reset for six hours" schedule_expression = "cron(0/5 17-23 * * ? *)" - - tags = { - app = var.app_name - } } output "aws_cloudwatch_event_rule_once_daily_at_destiny_reset_arn" { diff --git a/terraform/modules/event_bridge/variables.tf b/terraform/modules/event_bridge/variables.tf deleted file mode 100644 index cdf10d6..0000000 --- a/terraform/modules/event_bridge/variables.tf +++ /dev/null @@ -1,4 +0,0 @@ -variable "app_name" { - description = "app name" - type = string -} diff --git a/terraform/modules/iam/main.tf b/terraform/modules/iam/main.tf index 502f7e2..55e9443 100644 --- a/terraform/modules/iam/main.tf +++ b/terraform/modules/iam/main.tf @@ -14,10 +14,6 @@ resource "aws_iam_role" "destiny_insights_bot" { } } POLICY - - tags = { - app = var.app_name - } } resource "aws_iam_policy" "destiny_insights_bot_logs" { @@ -40,10 +36,6 @@ resource "aws_iam_policy" "destiny_insights_bot_logs" { ] } EOF - - tags = { - app = var.app_name - } } resource "aws_iam_role_policy_attachment" "attach_logs" { @@ -67,10 +59,6 @@ resource "aws_iam_policy" "destiny_insights_bot_sns" { ] } EOF - - tags = { - app = var.app_name - } } resource "aws_iam_role_policy_attachment" "attach_sns" { @@ -96,10 +84,6 @@ resource "aws_iam_policy" "destiny_insights_bot_parameter_store" { ] } EOF - - tags = { - app = var.app_name - } } resource "aws_iam_role_policy_attachment" "attach_parameter_store" { @@ -126,10 +110,6 @@ resource "aws_iam_policy" "destiny_insights_mods" { ] } EOF - - tags = { - app = var.app_name - } } resource "aws_iam_role_policy_attachment" "attach_destiny_insights_mods_dynamodb" { @@ -156,10 +136,6 @@ resource "aws_iam_policy" "destiny_insights_xur" { ] } EOF - - tags = { - app = var.app_name - } } resource "aws_iam_role_policy_attachment" "attach_destiny_insights_xur_dynamodb" { diff --git a/terraform/modules/iam/variables.tf b/terraform/modules/iam/variables.tf index ed75009..f218dd0 100644 --- a/terraform/modules/iam/variables.tf +++ b/terraform/modules/iam/variables.tf @@ -1,8 +1,3 @@ -variable "app_name" { - description = "app name" - type = string -} - variable "error_sns_topic" { description = "SNS Topic ARN to trigger on lambda failure" type = string diff --git a/terraform/modules/lambda/main.tf b/terraform/modules/lambda/main.tf index 0000283..cffdd80 100644 --- a/terraform/modules/lambda/main.tf +++ b/terraform/modules/lambda/main.tf @@ -6,10 +6,6 @@ resource "aws_lambda_function" "destiny_insights_bot" { runtime = "nodejs14.x" memory_size = 128 timeout = 60 - - tags = { - app = var.app_name - } } resource "aws_lambda_permission" "allow_cloudwatch_to_call_destiny_insights_bot" { diff --git a/terraform/modules/lambda/variables.tf b/terraform/modules/lambda/variables.tf index 6dd7795..daf32fc 100644 --- a/terraform/modules/lambda/variables.tf +++ b/terraform/modules/lambda/variables.tf @@ -1,8 +1,3 @@ -variable "app_name" { - description = "app name" - type = string -} - variable "error_sns_topic" { description = "SNS Topic ARN to trigger on lambda failure" type = string diff --git a/terraform/provider.tf b/terraform/provider.tf index c9d7ccb..1be9095 100644 --- a/terraform/provider.tf +++ b/terraform/provider.tf @@ -1,3 +1,9 @@ provider "aws" { region = var.aws_region + + default_tags { + tags = { + app = "destiny-insights-bot" + } + } } diff --git a/terraform/variables.tf b/terraform/variables.tf index 6e02dec..d68d22e 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -1,9 +1,3 @@ -variable "app_name" { - description = "app name" - type = string - default = "destiny-insights-bot" -} - variable "aws_region" { description = "Region for the infrastructure" type = string