File tree Expand file tree Collapse file tree 9 files changed +51
-41
lines changed Expand file tree Collapse file tree 9 files changed +51
-41
lines changed Original file line number Diff line number Diff line change 2020 env :
2121 HUSKY : " 0"
2222
23+ - name : Setup Terraform
24+ uses : hashicorp/setup-terraform@v2
25+ with :
26+ terraform_version : 1.12.2
27+
28+
2329 - name : Set up Node
2430 uses : actions/setup-node@v4
2531 with :
@@ -102,6 +108,11 @@ jobs:
102108 node-version : 22.x
103109 cache : " yarn"
104110
111+ - name : Setup Terraform
112+ uses : hashicorp/setup-terraform@v2
113+ with :
114+ terraform_version : 1.12.2
115+
105116 - name : Restore Yarn Cache
106117 uses : actions/cache@v4
107118 with :
Original file line number Diff line number Diff line change @@ -96,6 +96,8 @@ deploy_prod: check_account_prod
9696deploy_dev : check_account_dev
9797 @echo " Deploying CloudFormation stack..."
9898 sam deploy $(common_params ) --parameter-overrides $(run_env ) =dev $(set_application_prefix ) =$(application_key ) $(set_application_name ) =" $( application_name) " S3BucketPrefix=" $( s3_bucket_prefix) "
99+ @echo " Deploying Terraform..."
100+ terraform -chdir=terraform/envs/qa apply -auto-approve
99101 make postdeploy
100102
101103invalidate_cloudfront :
@@ -121,6 +123,10 @@ test_live_integration: install
121123test_unit : install
122124 yarn lint
123125 cfn-lint cloudformation/** /*
126+ terraform -chdir=terraform/envs/qa fmt -check
127+ terraform -chdir=terraform/envs/prod fmt -check
128+ terraform -chdir=terraform/envs/qa validate
129+ terraform -chdir=terraform/envs/prod validate
124130 yarn prettier
125131 yarn test:unit
126132
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ Resources:
1111 AppApiLambdaLogGroup :
1212 Type : AWS::Logs::LogGroup
1313 DeletionPolicy : Retain
14+ UpdateReplacePolicy : Retain
1415 Properties :
1516 LogGroupName :
1617 Fn::Sub : /aws/lambda/${LambdaFunctionName}
Original file line number Diff line number Diff line change @@ -9,14 +9,20 @@ terraform {
99 required_version = " >= 1.2"
1010}
1111
12+ provider "aws" {
13+ region = " us-east-1"
14+ default_tags {
15+ tags = {
16+ project = var.ProjectId
17+ }
18+ }
19+ }
1220
1321import {
1422 to = aws_cloudwatch_log_group. main_app_logs
15- id = " ${ var . resource_prefix } -logs "
23+ id = " /aws/lambda/ ${ var . ProjectId } -lambda "
1624}
17-
18-
1925resource "aws_cloudwatch_log_group" "main_app_logs" {
20- name = " ${ var . resource_prefix } -logs "
21- retention_in_days = var. retention_in_days
26+ name = " /aws/lambda/ ${ var . ProjectId } -lambda "
27+ retention_in_days = var. LogRetentionDays
2228}
Original file line number Diff line number Diff line change 1+ variable "LogRetentionDays" {
2+ type = number
3+ default = 90
4+ }
5+
6+ variable "ProjectId" {
7+ type = string
8+ default = " infra-core-api"
9+ }
10+
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -11,10 +11,18 @@ terraform {
1111
1212provider "aws" {
1313 region = " us-east-1"
14+ default_tags {
15+ tags = {
16+ project = var.ProjectId
17+ }
18+ }
1419}
1520
16- module "cloudwatch_logs" {
17- source = " ../../modules/cloudwatch_logs"
18- resource_prefix = var. ResourcePrefix
21+ import {
22+ to = aws_cloudwatch_log_group. main_app_logs
23+ id = " /aws/lambda/${ var . ProjectId } -lambda"
24+ }
25+ resource "aws_cloudwatch_log_group" "main_app_logs" {
26+ name = " /aws/lambda/${ var . ProjectId } -lambda"
1927 retention_in_days = var. LogRetentionDays
2028}
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ variable "LogRetentionDays" {
33 default = 7
44}
55
6- variable "ResourcePrefix " {
6+ variable "ProjectId " {
77 type = string
88 default = " infra-core-api"
99}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments