Skip to content

Commit

Permalink
set boolean as strings instead
Browse files Browse the repository at this point in the history
  • Loading branch information
ryantanjunming committed Oct 11, 2024
1 parent faf8017 commit b4d6661
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/resource-metadata/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { sendToCoralogix } from './coralogix.js'
import { collectEc2Resources } from './ec2.js';

const validateAndExtractConfiguration = () => {
const excludeEC2 = process.env.IS_EC2_RESOURCE_TYPE_EXCLUDED;
const excludeLambda = process.env.IS_LAMBDA_RESOURCE_TYPE_EXCLUDED;
const excludeEC2 = String(process.env.IS_EC2_RESOURCE_TYPE_EXCLUDED).toLowerCase() === "true"
const excludeLambda = String(process.env.IS_LAMBDA_RESOURCE_TYPE_EXCLUDED).toLowerCase() === "true"
return { excludeEC2, excludeLambda };
}
const { excludeEC2, excludeLambda } = validateAndExtractConfiguration();
Expand Down
26 changes: 16 additions & 10 deletions src/resource-metadata/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,17 @@ Parameters:
Default: 'True'
IsEC2ResourceTypeExcluded:
Type: String
Description: '[True/False]'
Description: Is EC2 Resource Type Excluded?
AllowedValues:
- 'True'
- 'False'
Default: 'False'
IsLambdaResourceTypeExcluded:
Type: String
Description: '[True/False]'
Description: Is Lambda Resource Type Excluded?
AllowedValues:
- 'True'
- 'False'
Default: 'False'
Mappings:
CoralogixRegionMap:
Expand Down Expand Up @@ -269,12 +275,12 @@ Resources:
AWS_MAX_ATTEMPTS: 10
IS_EC2_RESOURCE_TYPE_EXCLUDED: !If
- IsEC2ResourceTypeExcluded
- true
- false
- 'true'
- 'false'
IS_LAMBDA_RESOURCE_TYPE_EXCLUDED: !If
- IsLambdaResourceTypeExcluded
- true
- false
- 'true'
- 'false'
Events:
ScheduledEvent:
Type: Schedule
Expand Down Expand Up @@ -366,12 +372,12 @@ Resources:
- Ref: ApiKey
IS_EC2_RESOURCE_TYPE_EXCLUDED: !If
- IsEC2ResourceTypeExcluded
- true
- false
- 'true'
- 'false'
IS_LAMBDA_RESOURCE_TYPE_EXCLUDED: !If
- IsLambdaResourceTypeExcluded
- true
- false
- 'true'
- 'false'
Events:
ScheduledEvent:
Type: Schedule
Expand Down

0 comments on commit b4d6661

Please sign in to comment.