diff --git a/cloudformation/logs.yml b/cloudformation/logs.yml deleted file mode 100644 index 3fc5ee5b..00000000 --- a/cloudformation/logs.yml +++ /dev/null @@ -1,28 +0,0 @@ -AWSTemplateFormatVersion: '2010-09-09' -Description: Stack Log Groups -Transform: AWS::Serverless-2016-10-31 - -Resources: - AppAuditLog: - Type: "AWS::DynamoDB::Table" - DeletionPolicy: "Retain" - UpdateReplacePolicy: "Retain" - Properties: - BillingMode: "PAY_PER_REQUEST" - TableName: infra-core-api-audit-log - DeletionProtectionEnabled: true - PointInTimeRecoverySpecification: - PointInTimeRecoveryEnabled: true - AttributeDefinitions: - - AttributeName: module - AttributeType: S - - AttributeName: createdAt - AttributeType: N - KeySchema: - - AttributeName: module - KeyType: HASH - - AttributeName: createdAt - KeyType: RANGE - TimeToLiveSpecification: - AttributeName: expiresAt - Enabled: true diff --git a/cloudformation/main.yml b/cloudformation/main.yml index 5ecaa07e..cc688642 100644 --- a/cloudformation/main.yml +++ b/cloudformation/main.yml @@ -85,11 +85,6 @@ Resources: SqsQueueArn: !Sub "arn:aws:sqs:${AWS::Region}:${AWS::AccountId}:infra-core-api-sqs" LinkryKvArn: !GetAtt LinkryRecordsCloudfrontStore.Arn - AppLogGroups: - Type: AWS::Serverless::Application - Properties: - Location: ./logs.yml - LinkryRecordSetv4: Condition: IsDev Type: AWS::Route53::RecordSet @@ -218,8 +213,6 @@ Resources: AppApiLambdaFunction: Type: AWS::Serverless::Function - DependsOn: - - AppLogGroups Properties: Architectures: [arm64] CodeUri: ../dist/lambda @@ -261,8 +254,6 @@ Resources: AppSqsLambdaFunction: Type: AWS::Serverless::Function - DependsOn: - - AppLogGroups Properties: Architectures: [arm64] CodeUri: ../dist/sqsConsumer diff --git a/terraform/envs/prod/main.tf b/terraform/envs/prod/main.tf index 86ace28f..6f5c608b 100644 --- a/terraform/envs/prod/main.tf +++ b/terraform/envs/prod/main.tf @@ -49,3 +49,31 @@ module "sqs_queues" { source = "../../modules/sqs" resource_prefix = var.ProjectId } + +import { + to = aws_dynamodb_table.app_audit_log + id = "${var.ProjectId}-audit-log" +} + +resource "aws_dynamodb_table" "app_audit_log" { + billing_mode = "PAY_PER_REQUEST" + name = "${var.ProjectId}-audit-log" + deletion_protection_enabled = true + hash_key = "module" + range_key = "createdAt" + point_in_time_recovery { + enabled = true + } + attribute { + name = "module" + type = "S" + } + attribute { + name = "createdAt" + type = "N" + } + ttl { + attribute_name = "expiresAt" + enabled = true + } +} diff --git a/terraform/envs/qa/main.tf b/terraform/envs/qa/main.tf index 2db6396c..eb920b6b 100644 --- a/terraform/envs/qa/main.tf +++ b/terraform/envs/qa/main.tf @@ -36,3 +36,31 @@ module "sqs_queues" { source = "../../modules/sqs" resource_prefix = var.ProjectId } + +import { + to = aws_dynamodb_table.app_audit_log + id = "${var.ProjectId}-audit-log" +} + +resource "aws_dynamodb_table" "app_audit_log" { + billing_mode = "PAY_PER_REQUEST" + name = "${var.ProjectId}-audit-log" + deletion_protection_enabled = true + hash_key = "module" + range_key = "createdAt" + point_in_time_recovery { + enabled = true + } + attribute { + name = "module" + type = "S" + } + attribute { + name = "createdAt" + type = "N" + } + ttl { + attribute_name = "expiresAt" + enabled = true + } +}