Skip to content

Commit ec36e4c

Browse files
sanG-githublongnd
andauthored
Release - 0.2.0 (#29)
* [#11] Init project from the template * [#11] Add Terraform linting code * [#11] Missing EOF * Update .github/workflows/lint_code.yml Co-authored-by: Long Nguyen <nguyenduclong@msn.com> * [#11] Add checkov flow * [#11] Using concurrency * [#11] Update permission * [#11] Setup initial project from Git template (#16) * [#11] Init project from the template * [#11] Add Terraform linting code * [#11] Missing EOF * Update .github/workflows/lint_code.yml Co-authored-by: Long Nguyen <nguyenduclong@msn.com> * [#11] Add checkov flow * [#11] Using concurrency * [#11] Update permission --------- Co-authored-by: Long Nguyen <nguyenduclong@msn.com> * [#12] Update gitignore * [#12] Add aws provider * [#12] Update README.md * [#12] Integrate Terraform Cloud * [#12] Add CODEOWNERS * [#10] Add wiki * [#4] Setup ECR * [#4] Linter * [#4] Linter * [#4] Linter * [#4] Linter * update flow * [#4] Fix typo * [#4] Use checkov config file * [#4] Fix typo * [#4] Remove redundant local * [#4] Add sensitive option * [#4] Move the environment to variable * [#4] Rename folder to code * [#4] Missing EOF * [#4] Update naming * [#4] Remove redundant tfsec rule * [#4] Use tags instead of name * [#4] Remove aws_secret_key and aws_access_key * [#1] Add IAM group * [#1] Add IAM groups, users, group_users membership * [#1] Linter * [#1] Missing EOF * [#1] Disable rules inline * [#1] Update format * [#1] Linter * [#1] Remove redundant path * [#1] User must have MFA enabled * [#1] Move Path to locals.tf * [#13] Setup VPC * [#13] Disable tfsec rule * [#13] Use commit hash instead * [#13] Linter * [#13] Missing EOF * [#13] Change namespace name * [#13] Fix syntax error * [#3] Add secretsmanager * [#3] Linter * [#13] Fix syntax error * [#8] Setup CloudWatch * [#8] Setup CloudWatch with KMS * [#8] Enable KMS * [#8] Ensure CloudWatch log groups retains logs for at least 1 year * [#7] Setup S3 * [#7] Add logging bucket * [#7] Disable tfsec rules * [#7] Disable checkov rules * [#7] Use local variables * [#8] Update description for KMS * [#7] Update bucket name --------- Co-authored-by: Long Nguyen <nguyenduclong@msn.com>
1 parent 66a8352 commit ec36e4c

35 files changed

+730
-1
lines changed

.checkov.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
evaluate-variables: true
3+
framework: terraform
4+
quiet: true

.github/workflows/lint_code.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ jobs:
4646
id: checkov
4747
uses: bridgecrewio/checkov-action@master
4848
with:
49-
args: --quiet --framework terraform
49+
config_file: .checkov.yml

core/locals.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
locals {
2+
# Application name
3+
app_name = "nimble-devops-ic-web"
4+
5+
# The owner of the infrastructure, used to tag the resources, e.g. `acme-web`
6+
owner = "sanghuynh20000"
7+
8+
# AWS region
9+
region = "ap-southeast-1"
10+
}

core/main.tf

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
terraform {
2+
cloud {
3+
organization = "devops-ic"
4+
5+
workspaces {
6+
tags = ["aws-infrastructure"]
7+
}
8+
}
9+
}
10+
11+
module "cloudwatch" {
12+
source = "../modules/cloudwatch"
13+
14+
kms_key_id = module.secrets_manager.secret_cloudwatch_log_key_arn
15+
}
16+
17+
module "secrets_manager" {
18+
source = "../modules/secrets_manager"
19+
20+
secrets = {
21+
secret_key_base = var.secret_key_base
22+
}
23+
}
24+
25+
module "vpc" {
26+
source = "../modules/vpc"
27+
}
28+
29+
module "s3" {
30+
source = "../modules/s3"
31+
}

core/providers.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
terraform {
2+
required_providers {
3+
aws = {
4+
source = "hashicorp/aws"
5+
version = "~> 5.0"
6+
}
7+
}
8+
}
9+
10+
provider "aws" {
11+
region = local.region
12+
13+
default_tags {
14+
tags = {
15+
Environment = var.environment
16+
Owner = local.owner
17+
}
18+
}
19+
}

core/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
variable "environment" {
2+
description = "The application environment, used to tag the resources, e.g. `acme-web-staging`"
3+
type = string
4+
default = "staging"
5+
}
6+
7+
variable "secret_key_base" {
8+
description = "The secret key base for the application"
9+
type = string
10+
}

modules/cloudwatch/locals.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
locals {
2+
# The namespace for the CloudWatch log group
3+
namespace = "devops-ic-cloudwatch"
4+
5+
# Log retention in days
6+
retention_in_days = 400
7+
}

modules/cloudwatch/main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
resource "aws_cloudwatch_log_group" "this" {
2+
name = local.namespace
3+
retention_in_days = local.retention_in_days
4+
kms_key_id = var.kms_key_id
5+
}

modules/cloudwatch/outputs.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
output "aws_cloudwatch_log_group_name" {
2+
description = "CloudWatch log group name"
3+
value = aws_cloudwatch_log_group.this.name
4+
}

modules/cloudwatch/variables.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
variable "kms_key_id" {
2+
description = "The KMS key ID to use for encryption"
3+
type = string
4+
}

0 commit comments

Comments
 (0)