Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding CFT scanning support for the resources: #1149

Merged
merged 9 commits into from
Feb 11, 2022

Conversation

shreyas-phansalkar-189
Copy link
Contributor

  • aws_qldb_ledger
  • aws_ecs_cluster
  • aws_apigatewayv2_api
  • aws_db_event_subscription
  • aws_neptune_cluster_instance
  • aws_globalaccelerator_accelerator
  • aws_waf_size_constraint_set
  • aws_athena_workgroup

- aws_qldb_ledger
- aws_ecs_cluster
- aws_apigatewayv2_api
- aws_db_event_subscription
- aws_neptune_cluster_instance
- aws_globalaccelerator_accelerator
- aws_waf_size_constraint_set
- aws_athena_workgroup
// GetAPIGatewayV2ApiConfig returns config for aws_apigatewayv2_api resource
func GetAPIGatewayV2ApiConfig(a *apigatewayv2.Api) []AWSResourceConfig {

corsConfigData := make([]CorsConfigurationBlock, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add null check here

}

// GetDBEventSubscriptionConfig returns config for aws_db_event_subscription resource
func GetDBEventSubscriptionConfig(db *rds.EventSubscription) []AWSResourceConfig {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer using single letter names like its being done with every other resource

func GetEcsClusterConfig(e *ecs.Cluster) []AWSResourceConfig {

clusterSettingsData := make([]ClusterSettingsBlock, len(e.ClusterSettings))
for i := 0; i < len(e.ClusterSettings); i++ {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use range here to make code cleaner

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldnt we need i for indexing the clusterSettingsData array ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try this:

for i := range e.ClusterSettings {
.....
}

- api-gatewayv2-api.go
- db-event-subscription.go

Changes made:
- added a nil check for CorsConfiguration
- changed variable name in db-event-subscription.go

func setExecCommandConfigBlock(e *ecs.Cluster) []ExecuteCommandConfiguration {

execCommandConfigData := make([]ExecuteCommandConfiguration, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add null check


func setLogConfigurationBlock(e *ecs.Cluster) []LogConfigurationBlock {

logConfigData := make([]LogConfigurationBlock, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add null check

func setSizeConstraintSet(w *waf.SizeConstraintSet) []SizeConstraintSetBlock {
sizeConstraintSet := make([]SizeConstraintSetBlock, len(w.SizeConstraints))

for i := 0; i < len(w.SizeConstraints); i++ {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for i := range w.SizeConstraints {}

this could be cleaner

@sonarcloud
Copy link

sonarcloud bot commented Feb 11, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@shreyas-phansalkar-189 shreyas-phansalkar-189 merged commit b018d77 into master Feb 11, 2022
@shreyas-phansalkar-189 shreyas-phansalkar-189 deleted the feature/cft-support-aws branch February 11, 2022 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants