Skip to content

Commit aac86d7

Browse files
Upddated testcases
1 parent 4215f29 commit aac86d7

9 files changed

+260
-29
lines changed
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
AWSTemplateFormatVersion: '2010-09-09'
2+
Description: CloudFormation template to create an sumologic cloudtrail source.
3+
4+
Parameters:
5+
SumoLogicDeployment:
6+
Type: String
7+
Default: ""
8+
Description: "Enter au, ca, de, eu, fed, in, jp, kr, us1 or us2"
9+
SumoLogicAccessID:
10+
Type: String
11+
Description: "Sumo Logic Access ID. Used for Sumo Logic API calls."
12+
AllowedPattern: ".+"
13+
ConstraintDescription: "Sumo Logic Access ID can not be empty."
14+
SumoLogicAccessKey:
15+
Type: String
16+
Description: "Sumo Logic Access Key. Used for Sumo Logic API calls."
17+
AllowedPattern: ".+"
18+
ConstraintDescription: "Sumo Logic Access Key can not be empty."
19+
NoEcho: true
20+
SumoLambdaHelperArn:
21+
Type: String
22+
Default: ""
23+
Description: "Sumo Logic Lambda Helper"
24+
ConstraintDescription: "Sumo Logic Lambda Helper can not be empty."
25+
SumoLogicSourceRoleArn:
26+
Type: String
27+
Default: ""
28+
Description: "Sumo Logic Lambda source role"
29+
ConstraintDescription: "Sumo Logic Lambda source role can not be empty."
30+
SumoCollectorID:
31+
Type: String
32+
Default: ""
33+
Description: "Sumo Logic Collector ID can not be empty"
34+
CloudTrailLogsBucketName:
35+
Type: String
36+
Description: "Required when Bucket creation Flag = No. Provide an Existing bucket name that has CloudTrail logs."
37+
Default: ""
38+
AccountAlias:
39+
Type: String
40+
Description: "Provide an Alias for AWS account for identification in Sumo Logic Explorer View, metrics and logs. Please do not include special characters."
41+
AllowedPattern: "[a-z0-9]*"
42+
ConstraintDescription: "Alias must only contain lowercase letters, number and length less than or equal to 30 characters."
43+
MaxLength: 30
44+
45+
Mappings:
46+
SumoLogicEndpoints:
47+
au:
48+
apiendpoint: "https://api.au.sumologic.com/api/"
49+
ca:
50+
apiendpoint: "https://api.ca.sumologic.com/api/"
51+
de:
52+
apiendpoint: "https://api.de.sumologic.com/api/"
53+
eu:
54+
apiendpoint: "https://api.eu.sumologic.com/api/"
55+
fed:
56+
apiendpoint: "https://api.fed.sumologic.com/api/"
57+
in:
58+
apiendpoint: "https://api.in.sumologic.com/api/"
59+
jp:
60+
apiendpoint: "https://api.jp.sumologic.com/api/"
61+
kr:
62+
apiendpoint: "https://api.kr.sumologic.com/api/"
63+
us1:
64+
apiendpoint: "https://api.sumologic.com/api/"
65+
us2:
66+
apiendpoint: "https://api.us2.sumologic.com/api/"
67+
68+
Resources:
69+
SumoLogicCloudTrailS3Policy:
70+
Type: AWS::IAM::Policy
71+
Properties:
72+
PolicyName: SumoLogicAwsSourcesPoliciesS3CloudTrail
73+
Roles:
74+
- !Select [1, !Split ["/", !Ref SumoLogicSourceRoleArn]]
75+
PolicyDocument:
76+
Version: '2012-10-17'
77+
Statement:
78+
- Effect: Allow
79+
Action:
80+
- s3:GetObject
81+
- s3:GetObjectVersion
82+
- s3:ListBucketVersions
83+
- s3:ListBucket
84+
Resource:
85+
- !Sub
86+
- "arn:aws:s3:::${S3Bucket}"
87+
- S3Bucket: !Ref CloudTrailLogsBucketName
88+
- !Sub
89+
- "arn:aws:s3:::${S3Bucket}/*"
90+
- S3Bucket: !Ref CloudTrailLogsBucketName
91+
92+
CloudTrailSource:
93+
Type: Custom::AWSSource
94+
DependsOn: SumoLogicCloudTrailS3Policy
95+
Properties:
96+
SourceType: AwsCloudTrailBucket
97+
ServiceToken: !Ref SumoLambdaHelperArn
98+
Region: !Ref "AWS::Region"
99+
SourceName: "test-automation-awso-<TestcaseName>"
100+
TargetBucketName: !Ref CloudTrailLogsBucketName
101+
RemoveOnDeleteStack: true
102+
SourceCategory: "test/automation/awso/cloudtrail/logs"
103+
CollectorId: !Ref SumoCollectorID
104+
SumoAccessID: !Ref SumoLogicAccessID
105+
SumoAccessKey: !Ref SumoLogicAccessKey
106+
SumoDeployment: !Ref SumoLogicDeployment
107+
PathExpression: "*"
108+
Fields:
109+
account: !Ref AccountAlias
110+
RoleArn: !Ref SumoLogicSourceRoleArn
111+
112+
Outputs:
113+
SumoCloudTrailAPIURL:
114+
Description: End point url of cloudtrail log source.
115+
#https://api.sumologic.com/api/v1/collectors/261725249/sources/1511494842
116+
Value: !Sub
117+
- "${BaseUrl}v1/collectors/${CollectorID}/sources/${SourceID}"
118+
- BaseUrl: !FindInMap [SumoLogicEndpoints, !Ref SumoLogicDeployment, apiendpoint]
119+
CollectorID: !Ref SumoCollectorID
120+
SourceID: !Select
121+
- 1
122+
- !Split
123+
- "/"
124+
- !Ref CloudTrailSource
125+
126+
127+

aws-observability/templates/test/setup-infra/create_sumo_cloudwatch_log_source.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AWSTemplateFormatVersion: '2010-09-09'
2-
Description: CloudFormation template to create an sumologic collector and source.
2+
Description: CloudFormation template to create an sumologic source.
33

44
Parameters:
55
SumoLogicDeployment:

aws-observability/templates/test/setup-infra/create_sumo_lambda_hepler.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AWSTemplateFormatVersion: '2010-09-09'
2-
Description: CloudFormation template to create an sumologic collector and source.
2+
Description: CloudFormation template to create a Sumo Logic Lambda Helper for provisioning Sumo Logic resources.
33

44
Parameters:
55
SumoLogicDeployment:
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
AWSTemplateFormatVersion: '2010-09-09'
2+
Description: CloudFormation template to create role for sumologic resource.
3+
4+
Parameters:
5+
SumoLogicDeployment:
6+
Type: String
7+
Default: ""
8+
Description: "Enter au, ca, de, eu, fed, in, jp, kr, us1 or us2"
9+
SumoLogicOrganizationId:
10+
Description: "Appears on the Account Overview page that displays information about your Sumo Logic organization. Used for IAM Role in Sumo Logic AWS Sources. Visit https://help.sumologic.com/docs/get-started/account-settings-preferences/"
11+
Type: String
12+
AllowedPattern: ".+"
13+
ConstraintDescription: "Sumo Logic Organization Id can not be empty."
14+
SumoLogicAccountID:
15+
Description: "Sumo Logic AWS account no."
16+
Type: String
17+
Default: 926226587429
18+
19+
Resources:
20+
SumoLogicSourceRole:
21+
Type: AWS::IAM::Role
22+
Metadata:
23+
cfn_nag:
24+
rules_to_suppress:
25+
- id: W11
26+
reason: "Metrics are collected for all available resources."
27+
Properties:
28+
AssumeRolePolicyDocument:
29+
Version: '2012-10-17'
30+
Statement:
31+
- Effect: Allow
32+
Principal:
33+
AWS: !Sub "arn:aws:iam::${SumoLogicAccountID}:root"
34+
Action: sts:AssumeRole
35+
Condition:
36+
StringEquals:
37+
sts:ExternalId: !Sub "${SumoLogicDeployment}:${SumoLogicOrganizationId}"
38+
Path: "/"
39+
Policies:
40+
- PolicyName: SumoLogicAwsSourcesPolicies
41+
PolicyDocument:
42+
Version: '2012-10-17'
43+
Statement:
44+
- Effect: Allow
45+
Action:
46+
- tag:GetResources
47+
- cloudwatch:ListMetrics
48+
- cloudwatch:GetMetricStatistics
49+
Resource:
50+
"*"
51+
52+
Outputs:
53+
SumoLogicSourceRoleArn:
54+
Description: Sumo Logic source role
55+
Value: !GetAtt SumoLogicSourceRole.Arn
56+
57+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
Global:
3+
TemplatePath: "https://sumologic-appdev-aws-sam-apps.s3.amazonaws.com/aws-observability-versions/v2.10.0/sumologic_observability.master.template.yaml"
4+
StackName: AWSO-<datetime>
5+
ParallelTestsRun: 1
6+
GlobalParameters:
7+
Default:
8+
Section1eSumoLogicResourceRemoveOnDeleteStack: 'true'
9+
TestBundleName: lbBundle
10+
TestSuites:
11+
- 'test/testsuites/lb_testsuite.yaml'

aws-observability/templates/test/testcases/infra/default_param_no_cloudtrail_invalid_mapping_csv.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ TestCase:
320320
Section4bAwsXRaySourceName: "xray-ap-southeast-1"
321321
Section4cXraySourceCategory: "aws/observability/xray"
322322
sumoLambdaMetricsAppStack:
323-
Section2aAccountAlias: 'testenv'
323+
Section2aAccountAlias: 'infrat2'
324324
Section3aInstallApp: 'Yes'
325325
Section4aCloudWatchExistingSourceAPIUrl: ''
326326
Section5aCloudTrailLogsAPIUrl: ''

aws-observability/templates/test/testcases/infra/default_param_no_cloudtrail_valid_mapping_csv.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ TestCase:
320320
Section4bAwsXRaySourceName: "xray-ap-southeast-1"
321321
Section4cXraySourceCategory: "aws/observability/xray"
322322
sumoLambdaMetricsAppStack:
323-
Section2aAccountAlias: 'testenv'
323+
Section2aAccountAlias: 'infrat3'
324324
Section3aInstallApp: 'Yes'
325325
Section4aCloudWatchExistingSourceAPIUrl: ''
326326
Section5aCloudTrailLogsAPIUrl: ''

aws-observability/templates/test/testcases/infra/existing_cloudtrail_alb_source.yaml

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,31 @@ TestCase:
2121
SumoLogicDeployment: '${SUMO_DEPLOYMENT}'
2222
SumoLogicAccessID: '${SUMO_ACCESS_ID}'
2323
SumoLogicAccessKey: '${SUMO_ACCESS_KEY}'
24-
AccountAlias: "lbt1"
24+
AccountAlias: "infrat8"
2525
- CFNTemplateURL: "test/setup-infra/create_sumo_collector.yaml"
2626
CFNParameters:
2727
SumoLogicDeployment: '${SUMO_DEPLOYMENT}'
2828
SumoLogicAccessID: '${SUMO_ACCESS_ID}'
2929
SumoLogicAccessKey: '${SUMO_ACCESS_KEY}'
3030
SumoLambdaHelperArn: '${SumoLambdaHelperArn}'
31+
- CFNTemplateURL: "test/setup-infra/create_sumo_role.yaml"
32+
CFNParameters:
33+
SumoLogicDeployment: '${SUMO_DEPLOYMENT}'
34+
SumoLogicOrganizationId: '${SUMO_ORG_ID}'
35+
- CFNTemplateURL: "test/setup-infra/create_sumo_cloudtrail_source.yaml"
36+
CFNParameters:
37+
SumoLogicDeployment: '${SUMO_DEPLOYMENT}'
38+
SumoLogicAccessID: '${SUMO_ACCESS_ID}'
39+
SumoLogicAccessKey: '${SUMO_ACCESS_KEY}'
40+
SumoLambdaHelperArn: '${SumoLambdaHelperArn}'
41+
SumoLogicSourceRoleArn: '${SumoLogicSourceRoleArn}'
42+
SumoCollectorID: '${SumoCollectorID}'
43+
CloudTrailLogsBucketName: '${BucketName}'
44+
AccountAlias: '${AccountAlias}'
45+
ImpactedParametersPath:
46+
SumoCloudTrailAPIURL:
47+
- "parameters.Section6bCloudTrailLogsSourceUrl"
48+
- "assertions[AssertType==ParameterCheck].Assert.sumoLambdaMetricsAppStack.Section5aCloudTrailLogsAPIUrl"
3149
Parameters:
3250
Values:
3351
Section1aSumoLogicDeployment: '${SUMO_DEPLOYMENT}'
@@ -38,13 +56,13 @@ TestCase:
3856
Section2bAccountAliasMappingS3URL: ''
3957
Section3aInstallObservabilityApps: 'Yes'
4058
Section4aCreateMetricsSourceOptions: 'Kinesis Firehose Metrics Source'
41-
Section4cCloudWatchExistingSourceAPIUrl: 'https://api.us2.sumologic.com/api/v1/collectors/350831942/sources/2763251087'
59+
Section4cCloudWatchExistingSourceAPIUrl: 'https://api.sumologic.com/api/v1/collectors/261725249/sources/1511494842'
4260
Section5aAutoEnableS3LogsALBResourcesOptions: 'Both'
4361
Section5bALBCreateLogSource: 'No'
44-
Section5cALBLogsSourceUrl: 'https://api.us2.sumologic.com/api/v1/collectors/350831942/sources/2763251087'
62+
Section5cALBLogsSourceUrl: 'https://api.sumologic.com/api/v1/collectors/261725249/sources/1511494842'
4563
Section5dALBS3LogsBucketName: 'newapigateway'
4664
Section6aCreateCloudTrailLogSource: 'No'
47-
Section6bCloudTrailLogsSourceUrl: 'https://api.us2.sumologic.com/api/v1/collectors/350831942/sources/2763251087'
65+
Section6bCloudTrailLogsSourceUrl: 'https://api.sumologic.com/api/v1/collectors/261725249/sources/1511494842'
4866
Section7aLambdaCreateCloudWatchLogsSourceOptions: 'None'
4967
Section8aRootCauseExplorerOptions: 'Both'
5068
Section9aAutoEnableS3LogsELBResourcesOptions: 'None'
@@ -232,27 +250,27 @@ TestCase:
232250
Section2aAccountAlias: 'infrat8'
233251
Section3aInstallApp: 'Yes'
234252
Section4aCloudWatchExistingSourceAPIUrl: ''
235-
Section5aALBLogsAPIUrl: 'https://api.us2.sumologic.com/api/v1/collectors/350831942/sources/2763251087'
253+
Section5aALBLogsAPIUrl: 'https://api.sumologic.com/api/v1/collectors/261725249/sources/1511494842'
236254
Section5bALBLogsSourceName: ''
237255
sumoDynamoDBMetricsAppStack:
238256
Section2aInstallApp: 'Yes'
239-
Section3aCloudTrailLogsSourceName: 'test source 2'
257+
Section3aCloudTrailLogsSourceName: 'test-automation-awso-existingCloudTrailAlbSource'
240258
Section3bCloudTrailSourceUpdated: 'Yes'
241259
sumoRdsMetricsAppStack:
242260
Section2aInstallApp: 'Yes'
243-
Section3aCloudTrailLogsSourceName: 'test source 2'
261+
Section3aCloudTrailLogsSourceName: 'test-automation-awso-existingCloudTrailAlbSource'
244262
Section3bCloudTrailSourceUpdated: 'Yes'
245263
sumoApiGatewayMetricsAppStack:
246264
Section2aInstallApp: 'Yes'
247-
Section3aCloudTrailLogsSourceName: 'test source 2'
265+
Section3aCloudTrailLogsSourceName: 'test-automation-awso-existingCloudTrailAlbSource'
248266
Section3bCloudTrailSourceUpdated: 'Yes'
249267
sumoSNSAppStack:
250268
Section2aInstallApp: 'Yes'
251-
Section3aCloudTrailLogsSourceName: 'test source 2'
269+
Section3aCloudTrailLogsSourceName: 'test-automation-awso-existingCloudTrailAlbSource'
252270
Section3bCloudTrailSourceUpdated: 'Yes'
253271
sumoSQSAppStack:
254272
Section2aInstallApp: 'Yes'
255-
Section3aCloudTrailLogsSourceName: 'test source 2'
273+
Section3aCloudTrailLogsSourceName: 'test-automation-awso-existingCloudTrailAlbSource'
256274
Section3bCloudTrailSourceUpdated: 'Yes'
257275
RootCauseAppStack:
258276
Section2aInstallApp: 'Yes'
@@ -267,17 +285,17 @@ TestCase:
267285
Section2aAccountAlias: 'infrat8'
268286
Section3aInstallApp: 'Yes'
269287
Section4aCloudWatchExistingSourceAPIUrl: ''
270-
Section5aCloudTrailLogsAPIUrl: 'https://api.us2.sumologic.com/api/v1/collectors/350831942/sources/2763251087'
288+
Section5aCloudTrailLogsAPIUrl: 'https://api.sumologic.com/api/v1/collectors/261725249/sources/1511494842'
271289
Section5bCloudTrailLogsSourceName: ''
272290
Section6aCloudWatchLogsAPIUrl: ''
273291
Section6bCloudWatchLogsSourceName: ''
274292
sumoECSMetricsAppStack:
275293
Section2aInstallApp: 'Yes'
276-
Section3aCloudTrailLogsSourceName: 'test source 2'
294+
Section3aCloudTrailLogsSourceName: 'test-automation-awso-existingCloudTrailAlbSource'
277295
Section3bCloudTrailSourceUpdated: 'Yes'
278296
sumoElasticCacheMetricsAppStack:
279297
Section2aInstallApp: 'Yes'
280-
Section3aCloudTrailLogsSourceName: 'test source 2'
298+
Section3aCloudTrailLogsSourceName: 'test-automation-awso-existingCloudTrailAlbSource'
281299
Section3bCloudTrailSourceUpdated: 'Yes'
282300
sumoNlbMetricsAppStack:
283301
Section2aInstallApp: 'Yes'

0 commit comments

Comments
 (0)