Skip to content

Commit c3b6064

Browse files
committed
[#316] Remove v5 prefix
1 parent af9af58 commit c3b6064

File tree

32 files changed

+70
-148
lines changed

32 files changed

+70
-148
lines changed

.github/wiki/Architecture-overview.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ The project has the following main files and folders:
1717
│ │ └── versionControl # the templates files for version control
1818
│ └── terraform # the templates folders
1919
│ ├── core # the templates files for the core folder
20-
│ ├── core-v5 # the templates files for the v5 resource core folder
2120
│ └── shared # the templates files for the shared folder
2221
├── src # the source code of the CLI
2322
│ ├── commands # the commands of the CLI

.github/wiki/Security.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@ This document provides an overview of the security modules available in the infr
44

55
## Available Security Modules
66

7+
### CloudTrail
8+
9+
The CloudTrail module provides comprehensive API activity logging and monitoring for your AWS infrastructure to enhance security auditing and compliance.
10+
11+
#### Overview
12+
13+
AWS CloudTrail records API calls and events across your AWS account. This module:
14+
15+
- **Comprehensive event logging**: Captures management events, data events, and insight events based on configuration
16+
- **Multi-region support**: Can be configured to log events across all AWS regions for complete visibility
17+
- **CloudWatch integration**: Sends logs to CloudWatch for real-time monitoring and alerting
18+
- **S3 storage**: Stores all CloudTrail logs securely in Amazon S3 with configurable key prefix organization
19+
- **SNS notifications**: Integrates with SNS topics for immediate alerting on critical events
20+
- **Insight events**: Captures unusual activity patterns like API call rate and error rate anomalies
21+
722
### VPC Flow Log
823

924
The VPC Flow Log module captures network traffic information in your VPC to help with security monitoring and network analysis.

src/generators/addons/aws/constants.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const AWS_DEFAULT_REGION = 'ap-southeast-1';
22
const AWS_TEMPLATE_PATH = `addons/aws`;
3-
const AWS_PROVIDER_V5_PATH = `${AWS_TEMPLATE_PATH}/modules-v5/provider.tf`;
43
const AWS_SECURITY_GROUP_PATH = `modules/security_group`;
54
const AWS_SECURITY_GROUP_MAIN_PATH = `${AWS_SECURITY_GROUP_PATH}/main.tf`;
65
const AWS_SECURITY_GROUP_OUTPUTS_PATH = `${AWS_SECURITY_GROUP_PATH}/outputs.tf`;
@@ -9,7 +8,6 @@ const AWS_SECURITY_GROUP_VARIABLES_PATH = `${AWS_SECURITY_GROUP_PATH}/variables.
98
export {
109
AWS_DEFAULT_REGION,
1110
AWS_TEMPLATE_PATH,
12-
AWS_PROVIDER_V5_PATH,
1311
AWS_SECURITY_GROUP_PATH,
1412
AWS_SECURITY_GROUP_MAIN_PATH,
1513
AWS_SECURITY_GROUP_OUTPUTS_PATH,

src/generators/addons/aws/dependencies.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const AWS_MODULES: Record<AwsModuleName | string, AwsModule> = {
5353
},
5454
cloudtrail: {
5555
name: 'cloudtrail',
56-
path: 'modules-v5/cloudtrail',
56+
path: 'modules/cloudtrail',
5757
mainContent: 'module "cloudtrail"',
5858
applyModuleFunction: (options: AwsOptions) => applyAwsCloudtrail(options),
5959
},

src/generators/addons/aws/modules/cloudtrail.test.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,44 +38,44 @@ describe('CloudTrail add-on', () => {
3838

3939
it('creates expected files', () => {
4040
const expectedFiles = [
41-
'core-v5/main.tf',
42-
'core-v5/providers.tf',
43-
'core-v5/outputs.tf',
44-
'core-v5/variables.tf',
45-
'modules-v5/cloudtrail/main.tf',
46-
'modules-v5/cloudtrail/variables.tf',
47-
'modules-v5/cloudtrail/outputs.tf',
48-
'modules-v5/cloudtrail/s3-bucket-cloudtrail/main.tf',
49-
'modules-v5/cloudtrail/s3-bucket-cloudtrail/variables.tf',
50-
'modules-v5/cloudtrail/s3-bucket-cloudtrail/outputs.tf',
51-
'modules-v5/cloudtrail/sns/main.tf',
52-
'modules-v5/cloudtrail/sns/variables.tf',
53-
'modules-v5/cloudtrail/sns/outputs.tf',
54-
'modules-v5/cloudtrail/alerts/main.tf',
55-
'modules-v5/cloudtrail/alerts/variables.tf',
56-
'modules-v5/cloudtrail/alerts/outputs.tf',
41+
'core/main.tf',
42+
'core/providers.tf',
43+
'core/outputs.tf',
44+
'core/variables.tf',
45+
'modules/cloudtrail/main.tf',
46+
'modules/cloudtrail/variables.tf',
47+
'modules/cloudtrail/outputs.tf',
48+
'modules/cloudtrail/s3-bucket-cloudtrail/main.tf',
49+
'modules/cloudtrail/s3-bucket-cloudtrail/variables.tf',
50+
'modules/cloudtrail/s3-bucket-cloudtrail/outputs.tf',
51+
'modules/cloudtrail/sns/main.tf',
52+
'modules/cloudtrail/sns/variables.tf',
53+
'modules/cloudtrail/sns/outputs.tf',
54+
'modules/cloudtrail/alerts/main.tf',
55+
'modules/cloudtrail/alerts/variables.tf',
56+
'modules/cloudtrail/alerts/outputs.tf',
5757
];
5858

5959
expect(projectDir).toHaveFiles(expectedFiles);
6060
});
6161

6262
it('adds cloudtrail module to main.tf', () => {
6363
expect(projectDir).toHaveContentInFile(
64-
'core-v5/main.tf',
64+
'core/main.tf',
6565
cloudtrailModuleContent
6666
);
6767
});
6868

6969
it('adds cloudtrail variables to variables.tf', () => {
7070
expect(projectDir).toHaveContentInFile(
71-
'core-v5/variables.tf',
71+
'core/variables.tf',
7272
cloudtrailVariablesContent
7373
);
7474
});
7575

7676
it('adds cloudtrail outputs to outputs.tf', () => {
7777
expect(projectDir).toHaveContentInFile(
78-
'core-v5/outputs.tf',
78+
'core/outputs.tf',
7979
cloudtrailOutputsContent
8080
);
8181
});

src/generators/addons/aws/modules/cloudtrail.ts

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { dedent } from 'ts-dedent';
33
import { AwsOptions } from '@/generators/addons/aws';
44
import { isAwsModuleAdded } from '@/generators/addons/aws/dependencies';
55
import {
6-
INFRA_CORE_V5_MAIN_PATH,
7-
INFRA_CORE_V5_VARIABLES_PATH,
8-
INFRA_CORE_V5_OUTPUTS_PATH,
6+
INFRA_CORE_MAIN_PATH,
7+
INFRA_CORE_VARIABLES_PATH,
8+
INFRA_CORE_OUTPUTS_PATH,
99
} from '@/generators/terraform/constants';
1010
import { appendToFile, copy } from '@/helpers/file';
1111

@@ -63,7 +63,7 @@ const cloudtrailVariablesContent = dedent`
6363

6464
const cloudtrailModuleContent = dedent`
6565
module "cloudtrail_s3_bucket" {
66-
source = "../modules-v5/cloudtrail/s3-bucket-cloudtrail"
66+
source = "../modules/cloudtrail/s3-bucket-cloudtrail"
6767
6868
env_namespace = local.env_namespace
6969
s3_bucket_name = var.cloudtrail_s3_bucket_name
@@ -73,7 +73,7 @@ const cloudtrailModuleContent = dedent`
7373
}
7474
7575
module "cloudtrail_sns" {
76-
source = "../modules-v5/cloudtrail/sns"
76+
source = "../modules/cloudtrail/sns"
7777
7878
env_namespace = local.env_namespace
7979
sns_name = var.cloudtrail_sns_topic_name
@@ -82,7 +82,7 @@ const cloudtrailModuleContent = dedent`
8282
8383
module "cloudtrail" {
8484
depends_on = [module.cloudtrail_s3_bucket, module.cloudtrail_sns]
85-
source = "../modules-v5/cloudtrail"
85+
source = "../modules/cloudtrail"
8686
8787
env_namespace = local.env_namespace
8888
trail_name = var.cloudtrail_trail_name
@@ -99,7 +99,7 @@ const cloudtrailModuleContent = dedent`
9999
module "cloudtrail_alerts" {
100100
count = var.cloudtrail_enable_alerts ? 1 : 0
101101
depends_on = [module.cloudtrail_sns]
102-
source = "../modules-v5/cloudtrail/alerts"
102+
source = "../modules/cloudtrail/alerts"
103103
104104
env_namespace = local.env_namespace
105105
cloudtrail_log_group_name = "/aws/cloudtrail/\${var.cloudtrail_trail_name}"
@@ -116,29 +116,9 @@ const cloudtrailModuleContent = dedent`
116116
}`;
117117

118118
const cloudtrailOutputsContent = dedent`
119-
output "cloudtrail_s3_bucket_id" {
120-
description = "The ID of the S3 bucket for CloudTrail logs"
121-
value = module.cloudtrail_s3_bucket.s3_bucket_id
122-
}
123-
124-
output "cloudtrail_s3_bucket_arn" {
125-
description = "The ARN of the S3 bucket for CloudTrail logs"
126-
value = module.cloudtrail_s3_bucket.s3_bucket_arn
127-
}
128-
129119
output "cloudtrail_arn" {
130120
description = "The ARN of the CloudTrail"
131121
value = module.cloudtrail.cloudtrail_arn
132-
}
133-
134-
output "cloudtrail_sns_topic_arn" {
135-
description = "The ARN of the SNS topic for CloudTrail notifications"
136-
value = module.cloudtrail_sns.sns_topic_arn
137-
}
138-
139-
output "cloudtrail_arm" {
140-
description = "The ARN of CloudTrail"
141-
value = module.cloudtrail.cloudtrail_arn
142122
}`;
143123

144124
const applyAwsCloudtrail = async (options: AwsOptions) => {
@@ -147,22 +127,22 @@ const applyAwsCloudtrail = async (options: AwsOptions) => {
147127
}
148128

149129
copy(
150-
`${AWS_TEMPLATE_PATH}/modules-v5/cloudtrail`,
151-
'modules-v5/cloudtrail',
130+
`${AWS_TEMPLATE_PATH}/modules/cloudtrail`,
131+
'modules/cloudtrail',
152132
options.projectName
153133
);
154134
appendToFile(
155-
INFRA_CORE_V5_VARIABLES_PATH,
135+
INFRA_CORE_VARIABLES_PATH,
156136
cloudtrailVariablesContent,
157137
options.projectName
158138
);
159139
appendToFile(
160-
INFRA_CORE_V5_MAIN_PATH,
140+
INFRA_CORE_MAIN_PATH,
161141
cloudtrailModuleContent,
162142
options.projectName
163143
);
164144
appendToFile(
165-
INFRA_CORE_V5_OUTPUTS_PATH,
145+
INFRA_CORE_OUTPUTS_PATH,
166146
cloudtrailOutputsContent,
167147
options.projectName
168148
);
Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import { AwsOptions } from '@/generators/addons/aws';
2-
import {
3-
AWS_TEMPLATE_PATH,
4-
AWS_PROVIDER_V5_PATH,
5-
} from '@/generators/addons/aws/constants';
2+
import { AWS_TEMPLATE_PATH } from '@/generators/addons/aws/constants';
63
import {
74
INFRA_CORE_PATH,
8-
INFRA_CORE_V5_PATH,
95
INFRA_SHARED_PATH,
106
} from '@/generators/terraform/constants';
117
import { copy } from '@/helpers/file';
@@ -21,15 +17,6 @@ const applyTerraformAwsProvider = async (options: AwsOptions) => {
2117
`${INFRA_SHARED_PATH}/providers.tf`,
2218
options.projectName
2319
);
24-
25-
// For advanced infrastructure, also copy to core-v5
26-
if (options.infrastructureType === 'advanced') {
27-
copy(
28-
AWS_PROVIDER_V5_PATH,
29-
`${INFRA_CORE_V5_PATH}/providers.tf`,
30-
options.projectName
31-
);
32-
}
3320
};
3421

3522
export default applyTerraformAwsProvider;

src/generators/terraform/constants.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ const INFRA_SHARED_MAIN_PATH = `${INFRA_SHARED_PATH}/main.tf`;
88
const INFRA_SHARED_OUTPUTS_PATH = `${INFRA_SHARED_PATH}/outputs.tf`;
99
const INFRA_SHARED_VARIABLES_PATH = `${INFRA_SHARED_PATH}/variables.tf`;
1010

11-
const INFRA_CORE_V5_PATH = 'core-v5/';
12-
const INFRA_CORE_V5_MAIN_PATH = `${INFRA_CORE_V5_PATH}/main.tf`;
13-
const INFRA_CORE_V5_OUTPUTS_PATH = `${INFRA_CORE_V5_PATH}/outputs.tf`;
14-
const INFRA_CORE_V5_VARIABLES_PATH = `${INFRA_CORE_V5_PATH}/variables.tf`;
15-
1611
export {
1712
INFRA_CORE_PATH,
1813
INFRA_CORE_MAIN_PATH,
@@ -22,8 +17,4 @@ export {
2217
INFRA_SHARED_MAIN_PATH,
2318
INFRA_SHARED_OUTPUTS_PATH,
2419
INFRA_SHARED_VARIABLES_PATH,
25-
INFRA_CORE_V5_PATH,
26-
INFRA_CORE_V5_MAIN_PATH,
27-
INFRA_CORE_V5_OUTPUTS_PATH,
28-
INFRA_CORE_V5_VARIABLES_PATH,
2920
};

src/generators/terraform/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { GeneralOptions } from '@/commands/generate';
44
import {
55
INFRA_CORE_MAIN_PATH,
66
INFRA_SHARED_MAIN_PATH,
7-
INFRA_CORE_V5_MAIN_PATH,
87
} from '@/generators/terraform/constants';
98
import { copy, rename, appendToFile } from '@/helpers/file';
109

@@ -21,7 +20,6 @@ const applyTerraformCore = async (generalOptions: GeneralOptions) => {
2120

2221
appendToFile(INFRA_CORE_MAIN_PATH, coreLocalsContent, projectName);
2322
appendToFile(INFRA_SHARED_MAIN_PATH, coreLocalsContent, projectName);
24-
appendToFile(INFRA_CORE_V5_MAIN_PATH, coreLocalsContent, projectName);
2523

2624
// Need to rename .gitignore to gitignore because NPN package doesn't include .gitignore
2725
// https://github.com/npm/npm/issues/3763

templates/addons/aws/modules-v5/provider.tf

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)