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

Added terraform files #4

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Agustin-Galarza
Copy link

No description provided.

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

defsec found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

Comment on lines 36 to 40
resource "aws_api_gateway_stage" "this" {
deployment_id = aws_api_gateway_deployment.this.id
rest_api_id = aws_api_gateway_rest_api.this.id
stage_name = var.stage
}

Check warning

Code scanning / defsec

API Gateway stages for V1 and V2 should have access logging enabled Warning

Access logging is not configured.
modules/api_gateway/main.tf Fixed Show fixed Hide fixed
Comment on lines +1 to +23
resource "aws_dynamodb_table" "this" {
name = var.name
billing_mode = var.billing_mode.mode
read_capacity = var.billing_mode.mode == "PROVISIONED" ? var.billing_mode.read_capacity : null
write_capacity = var.billing_mode.mode == "PROVISIONED" ? var.billing_mode.write_capacity : null
hash_key = var.hash_key.name
range_key = var.range_key.name

attribute {
name = var.hash_key.name
type = var.hash_key.type
}

attribute {
name = var.range_key.name
type = var.range_key.type
}

server_side_encryption {
enabled = true
}

}

Check warning

Code scanning / defsec

Point in time recovery should be enabled to protect DynamoDB table Warning

Point-in-time recovery is not enabled.
Comment on lines +77 to +85
resource "aws_s3_bucket" "www" {
bucket = local.www_frontend_bucket_name
# object_lock_enabled = true
force_destroy = true

tags = {
type = "frontend"
}
}

Check warning

Code scanning / defsec

S3 Data should be versioned Warning

Bucket does not have versioning enabled
Comment on lines +2 to +11
resource "aws_s3_bucket" "frontend" {
bucket = var.frontend_name
# object_lock_enabled = true
force_destroy = true


tags = {
type = "frontend"
}
}

Check warning

Code scanning / defsec

S3 Data should be versioned Warning

Bucket does not have versioning enabled
Comment on lines +66 to +74
resource "aws_s3_bucket_server_side_encryption_configuration" "frontend" {
bucket = aws_s3_bucket.frontend.id

rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}

Check failure

Code scanning / defsec

S3 encryption should use Customer Managed Keys Error

Bucket does not encrypt data with a customer managed key.
Comment on lines +19 to +21
server_side_encryption {
enabled = true
}

Check notice

Code scanning / defsec

DynamoDB tables should use at rest encryption with a Customer Managed Key Note

Table encryption explicitly uses the default KMS key.
Comment on lines +125 to +133
resource "aws_s3_bucket_server_side_encryption_configuration" "www" {
bucket = aws_s3_bucket.www.id

rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}

Check failure

Code scanning / defsec

S3 encryption should use Customer Managed Keys Error

Bucket does not encrypt data with a customer managed key.
also applied recursive formatting.

Choose a reason for hiding this comment

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

Por que dejar este archivo vacio

Choose a reason for hiding this comment

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

Esto comentado no tiene sentido.

}
}

# resource "aws_iam_role" "example_role" {

Choose a reason for hiding this comment

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

Mas alla de que esta comentado, no esta bien que pongan el iam role junto con el provider

@@ -0,0 +1,26 @@

data "aws_availability_zones" "available" {

Choose a reason for hiding this comment

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

Tienen un datasource en locals, esto iria en el archivo datasources


security_groups_prefix = "${local.name}-security-group"

frontend_bucket_name = "dev.condor.com"

Choose a reason for hiding this comment

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

Esto debería ser una variable al igual que los campos que estan por debajo

methods = [
{
path = "reports"
methods = [

Choose a reason for hiding this comment

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

Esto podría haber estado definido en locals.

@@ -0,0 +1,39 @@
resource "aws_s3_bucket" "this" {

Choose a reason for hiding this comment

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

Si bien no esta mal lo que hacen de tener dos modulos, uno para logging y uno para el front, idealmente tendrían que tener un modulo s3 lo suficientemente customizable para que puedan funcionar ambas necesidades con el mismo módulo.

@@ -0,0 +1,133 @@
// condor.com bucket

Choose a reason for hiding this comment

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

Venían llamando a todos los resources this, que suele ser convención, y aca cambiaron a llamar todo a frontend.

@@ -0,0 +1,28 @@
resource "aws_lambda_function" "index" {

Choose a reason for hiding this comment

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

Acá tambien, dejaron de usar la convención "this"

@@ -0,0 +1,9 @@
terraform {
required_version = "1.5.7"

Choose a reason for hiding this comment

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

Aca tienen que poner >= porque sino es esa versión específica

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants