Skip to content

Commit 2e9b192

Browse files
committed
create terraform setup for QA
1 parent 4549938 commit 2e9b192

File tree

8 files changed

+168
-1
lines changed

8 files changed

+168
-1
lines changed

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"rvest.vs-code-prettier-eslint",
55
"eamodio.gitlens",
66
"ms-vscode.makefile-tools",
7-
"amazonwebservices.aws-toolkit-vscode"
7+
"amazonwebservices.aws-toolkit-vscode",
8+
"hashicorp.terraform"
89
]
910
}

cloudformation/logs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Parameters:
1010
Resources:
1111
AppApiLambdaLogGroup:
1212
Type: AWS::Logs::LogGroup
13+
DeletionPolicy: Retain
1314
Properties:
1415
LogGroupName:
1516
Fn::Sub: /aws/lambda/${LambdaFunctionName}

terraform/.gitignore

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# OSX leaves these everywhere on SMB shares
2+
._*
3+
4+
# OSX trash
5+
.DS_Store
6+
7+
# Python
8+
*.pyc
9+
10+
# Emacs save files
11+
*~
12+
\#*\#
13+
.\#*
14+
15+
# Vim-related files
16+
[._]*.s[a-w][a-z]
17+
[._]s[a-w][a-z]
18+
*.un~
19+
Session.vim
20+
.netrwhist
21+
22+
### https://raw.github.com/github/gitignore/90f149de451a5433aebd94d02d11b0e28843a1af/Terraform.gitignore
23+
24+
# Local .terraform directories
25+
**/.terraform*
26+
27+
# .tfstate files
28+
*.tfstate
29+
*.tfstate.*
30+
31+
# Local tfvars terraform.tfvars
32+
**/*.tfvars
33+
34+
# tf lock file
35+
**/.terraform.lock.hcl
36+
37+
# Crash log files
38+
crash.log
39+
40+
# Ignore any .tfvars files that are generated automatically for each Terraform run. Most
41+
# .tfvars files are managed as part of configuration and so should be included in
42+
# version control.
43+
#
44+
# example.tfvars
45+
46+
# Ignore override files as they are usually used to override resources locally and so
47+
# are not checked in
48+
override.tf
49+
override.tf.json
50+
*_override.tf
51+
*_override.tf.json
52+
.idea/
53+
.vscode/
54+
# Kitchen files
55+
**/inspec.lock
56+
**.gem
57+
**/.kitchen
58+
**/.kitchen.local.yml
59+
**/Gemfile.lock
60+
# Plan files
61+
**/tmp_plan
62+
**/.tmp
63+
**/tmp
64+
65+
test/fixtures/shared/terraform.tfvars
66+
67+
test/integration/gcloud/config.sh
68+
test/integration/tmp
69+
70+
credentials.json
71+
72+
helpers/foundation-deployer/foundation-deployer
73+
helpers/foundation-deployer/.steps.json
74+
75+
# File to populate env vars used by Docker test runs
76+
.envrc
77+
78+
# Handle files generated on sed command by old (2013-) MacOS versions
79+
*.tf-e
80+
81+
# Go multi-module workspace sum
82+
go.work.sum

terraform/envs/qa/.terraform.lock.hcl

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

terraform/envs/qa/main.tf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
terraform {
2+
required_providers {
3+
aws = {
4+
source = "hashicorp/aws"
5+
version = "~> 5.92"
6+
}
7+
}
8+
9+
required_version = ">= 1.2"
10+
}
11+
12+
provider "aws" {
13+
region = "us-east-1"
14+
}
15+
16+
module "cloudwatch_logs" {
17+
source = "../../modules/cloudwatch_logs"
18+
resource_prefix = var.ResourcePrefix
19+
retention_in_days = var.LogRetentionDays
20+
}

terraform/envs/qa/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
variable "LogRetentionDays" {
2+
type = number
3+
default = 7
4+
}
5+
6+
variable "ResourcePrefix" {
7+
type = string
8+
default = "infra-core-api"
9+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
terraform {
2+
required_providers {
3+
aws = {
4+
source = "hashicorp/aws"
5+
version = "~> 5.92"
6+
}
7+
}
8+
9+
required_version = ">= 1.2"
10+
}
11+
12+
13+
import {
14+
to = aws_cloudwatch_log_group.main_app_logs
15+
id = "${var.resource_prefix}-logs"
16+
}
17+
18+
19+
resource "aws_cloudwatch_log_group" "main_app_logs" {
20+
name = "${var.resource_prefix}-logs"
21+
retention_in_days = var.retention_in_days
22+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
variable "resource_prefix" {
2+
type = string
3+
}
4+
5+
variable "retention_in_days" {
6+
type = number
7+
}

0 commit comments

Comments
 (0)