Repository navigation
Fix outdated tf - #29
alexiscolonna wants to merge 2 commits into
Conversation
WalkthroughThis change modernizes Terraform configuration syntax across ten AWS infrastructure files. Updates include correcting type declarations from quoted to unquoted strings, removing string interpolation in favor of direct attribute references, updating resource and data source syntax to quoted form, and refactoring S3 bucket resources to use separate ACL, versioning, logging, and encryption resources. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes The diff spans heterogeneous changes across ten files with varying complexity: repetitive interpolation removals, syntax corrections, and substantial S3 resource refactoring requiring understanding of new ACL/versioning/logging dependencies and state implications. Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Symbiotic Security scan resultsHi @alexiscolonna, we've reviewed your PR and here are our findings:
|
| Id | Severity | Vulnerability | File |
|---|---|---|---|
| V0 | TF-0212 There is no encryption specified or encryption is disabled on the RDS Cluster. |
terraform/aws/rds.tf (1-15) | |
| V1 | TF-0306 Ensure that Cloud SQL Database Instances are not publicly exposed |
terraform/gcp/big_data.tf (9) | |
| V2 | TF-0306 Ensure that Cloud SQL Database Instances are not publicly exposed |
terraform/gcp/big_data.tf (12) | |
| V3 | TF-0059 Legacy ABAC permissions are enabled. |
terraform/gcp/gke.tf (12) | |
| V4 | TF-0114 RDS encryption has not been enabled at a DB Instance level. |
terraform/aws/db-app.tf (18) | |
| V5 | TF-0490 RDS Publicly Accessible |
terraform/aws/db-app.tf (21) | |
| V6 | TF-0350 Instances in a subnet should not receive a public IP address by default. |
terraform/aws/ec2.tf (139) | |
| V7 | TF-0084 RDS Cluster and RDS instance should have backup retention longer than default 1 day |
terraform/aws/rds.tf (4) | |
| V8 | TF-0300 Enable automated backups to recover from data-loss |
terraform/gcp/big_data.tf (16) | |
| V9 | TF-0084 RDS Cluster and RDS instance should have backup retention longer than default 1 day |
terraform/aws/rds.tf (20) | |
| V10 | TF-0285 S3 Data should be versioned |
terraform/aws/ec2.tf (271-288) |
💡 Type
/symbot review <vuln-id>in a comment to get more details on a specific vulnerability.
✅ 1 vulnerability fixed
| Severity | Vulnerability | File |
|---|---|---|
| SYM_CONF_0026 Reliance on Insufficiently Trustworthy Component |
.github/workflows/main.yml (16) |
Note: You are seeing this because you or someone else with access to this repository has authorized Symbiotic Security to analyze PRs. If you haven't already, create an account and download our extension to detect, learn and fix in your IDE.
|
/symbot review V6 |
Symbiotic Security scan resultsHi @alexiscolonna, we've reviewed your PR and here are our findings:
|
| Id | Severity | Vulnerability | File |
|---|---|---|---|
| V0 | TF-0212 There is no encryption specified or encryption is disabled on the RDS Cluster. |
terraform/aws/rds.tf (1-15) | |
| V1 | TF-0306 Ensure that Cloud SQL Database Instances are not publicly exposed |
terraform/gcp/big_data.tf (9) | |
| V2 | TF-0306 Ensure that Cloud SQL Database Instances are not publicly exposed |
terraform/gcp/big_data.tf (12) | |
| V3 | TF-0059 Legacy ABAC permissions are enabled. |
terraform/gcp/gke.tf (12) | |
| V4 | TF-0114 RDS encryption has not been enabled at a DB Instance level. |
terraform/aws/db-app.tf (18) | |
| V5 | TF-0490 RDS Publicly Accessible |
terraform/aws/db-app.tf (21) | |
| V6 | TF-0350 Instances in a subnet should not receive a public IP address by default. |
terraform/aws/ec2.tf (139) | |
| V7 | SYM_CONF_0235 Insufficient Verification of Data Authenticity |
terraform/aws/ecr.tf (1-17) | |
| V8 | SYM_CONF_0279 Omission of Security-relevant Information |
terraform/aws/ecr.tf (1-17) | |
| V9 | SYM_CONF_0281 Key Management Errors |
terraform/aws/rds.tf (1-15) | |
| V10 | SYM_CONF_0196 Improper Access Control |
terraform/gcp/big_data.tf (1) | |
| V11 | TF-0084 RDS Cluster and RDS instance should have backup retention longer than default 1 day |
terraform/aws/rds.tf (4) | |
| V12 | TF-0300 Enable automated backups to recover from data-loss |
terraform/gcp/big_data.tf (16) | |
| V13 | SYM_GEN_0100 Use of Hard-coded Credentials |
terraform/aws/ec2.tf (16) | |
| V14 | TF-0084 RDS Cluster and RDS instance should have backup retention longer than default 1 day |
terraform/aws/rds.tf (20) |
This table only shows the 15 most important issues. To view all the issues introduced by this PR, use our IDE extension.
💡 Type
/symbot review <vuln-id>in a comment to get more details on a specific vulnerability.
✅ 7 vulnerabilities fixed
| Severity | Vulnerability | File |
|---|---|---|
| SYM_CONF_0026 Reliance on Insufficiently Trustworthy Component |
.github/workflows/main.yml (16) | |
| SYM_CONF_0130 Exposure of Sensitive Information to an Unauthorized Actor |
terraform/aws/eks.tf (10) | |
| SYM_CONF_0300 Key Management Errors |
terraform/aws/s3.tf (23-40) | |
| SYM_CONF_0131 Exposure of Sensitive Information to an Unauthorized Actor |
terraform/aws/es.tf (32) | |
| TF-0108 Buckets should have MFA deletion protection enabled. |
terraform/aws/s3.tf (70-72) | |
| TF-0108 Buckets should have MFA deletion protection enabled. |
terraform/aws/s3.tf (93-95) | |
| TF-0108 Buckets should have MFA deletion protection enabled. |
terraform/aws/s3.tf (116-118) |
Note: You are seeing this because you or someone else with access to this repository has authorized Symbiotic Security to analyze PRs. If you haven't already, create an account and download our extension to detect, learn and fix in your IDE.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
terraform/aws/consts.tf(1 hunks)terraform/aws/db-app.tf(4 hunks)terraform/aws/ec2.tf(3 hunks)terraform/aws/ecr.tf(2 hunks)terraform/aws/eks.tf(7 hunks)terraform/aws/es.tf(1 hunks)terraform/aws/iam.tf(1 hunks)terraform/aws/kms.tf(1 hunks)terraform/aws/lambda.tf(1 hunks)terraform/aws/s3.tf(5 hunks)
🔇 Additional comments (18)
terraform/aws/lambda.tf (1)
35-35: Solid interpolation cleanup.Removing unnecessary
${...}string interpolation is correct and aligns with modern Terraform idiom. The function attributes remain properly referenced.Also applies to: 38-38
terraform/aws/es.tf (1)
29-29: Clean HCL2 syntax update.Data source declaration updated to canonical quoted form. This modernization is the Terraform best practice and maintains all existing behavior.
terraform/aws/iam.tf (1)
27-27: Consistent interpolation removal.Direct attribute reference is cleaner and follows the pattern already established in this file (line 22).
terraform/aws/db-app.tf (3)
39-39: Idiomatic ignore_changes syntax.Unquoted identifiers in
ignore_changesare the modern Terraform convention and are functionally equivalent to quoted form.
150-150: Consistent interpolation cleanup.Removing unnecessary
${...}string interpolation across security groups, IAM roles, and subnet references maintains the same values while using cleaner HCL2 syntax.Also applies to: 157-157, 250-250
2-2: Thedb_namefield rename is correct and should be kept.The
db_namefield is the current supported argument for specifying the initial database name in the aws_db_instance resource, whilenamewas the older deprecated argument that has been removed in recent provider versions. This change represents a necessary modernization to use the valid current syntax and is not a breaking change.terraform/aws/kms.tf (1)
20-20: Clean reference syntax.Direct attribute reference instead of string interpolation is cleaner and idiomatic.
terraform/aws/ecr.tf (1)
1-1: HCL2 canonical syntax applied.Both resource type declarations updated to modern quoted form. This is the Terraform best practice and maintains all existing behavior.
Also applies to: 24-24
terraform/aws/eks.tf (4)
7-7: Solid EKS infrastructure foundation.Data source uses canonical quoted syntax. New IAM role, policy attachments, VPC, and initial subnet resources are properly structured with direct references to policy document and correct tag metadata.
Also applies to: 18-20, 33-36, 38-41, 43-59
61-87: Suspicious tag key duplication in subnets.The subnet tag blocks contain duplicate keys with different escape sequences (e.g., lines 77, 81, 84-85 in eks_subnet1 and corresponding lines in eks_subnet2). Keys like
"kubernetes.io/cluster/$${local.eks_name.value}"appear multiple times across the three merge blocks. Verify this is intentional and not a merge artifact or test data that should be cleaned up.Also applies to: 89-115
119-119: Correct dependency and reference syntax.The
role_arnproperly references the IAM role, anddepends_onuses bare resource references (not string-quoted), which is the correct modern Terraform meta-argument syntax.Also applies to: 127-128
142-148: Clean output references.Outputs correctly use direct attribute references instead of interpolation.
terraform/aws/s3.tf (4)
64-67: Well-structured configuration extraction.Extracting ACL, versioning, and logging to separate resources is sound practice and improves maintainability. Resource references are properly chained (e.g., logging targets logs bucket, data_science bucket targets logs bucket for destination). All use direct references without interpolation.
Also applies to: 89-99, 117-133
135-151: Clean logs bucket setup.New logs bucket properly isolated with its own metadata and tag structure. Separation from data_science bucket improves clarity.
153-161: Code syntax is correct—no issues found.The
ruleblock (singular) andkms_master_key_idwith ARN format are both valid and align with current Terraform AWS provider documentation. No changes needed.
23-40: Resource type migration is valid, but verify migration steps were completed.The change from
aws_s3_bucket_objecttoaws_s3_objectis correct—this is the official deprecation path in the AWS Terraform provider. However, if this change represents a migration from the deprecated resource type, Terraform will recreate the object on next apply unless you import the existing object into the new resource (or remove it from state).Confirm that either
terraform importwas executed for this resource or the old resource was removed from state to prevent unintended destruction and recreation of the S3 object.terraform/aws/ec2.tf (1)
3-3: HCL2 syntax modernization is correct.Direct references are the modern way to reference attributes in Terraform 0.12+, eliminating redundant interpolation markers. The changes on these lines correctly apply first-class expressions without the
${...}wrapper.Also applies to: 8-8, 55-55, 73-74
terraform/aws/consts.tf (1)
28-30: Variable type declarations properly modernized.Changing from
type = "string"(quoted string value) totype = string(unquoted type reference) correctly aligns with Terraform 0.12+ HCL2 syntax. This is a standard upgrade pattern for modernizing Terraform configurations.Also applies to: 33-36, 39-42, 45-48
| vpc_security_group_ids = [ | ||
| "${aws_security_group.web-node.id}"] |
There was a problem hiding this comment.
Incomplete refactoring: remove interpolation from vpc_security_group_ids.
In Terraform 0.12+, list expressions can be used directly without string interpolation. Line 7 still contains the deprecated "${aws_security_group.web-node.id}" syntax. This should be updated for consistency with the rest of the file.
Apply this diff to fix the incomplete refactoring:
vpc_security_group_ids = [
- "${aws_security_group.web-node.id}"]
+ aws_security_group.web-node.id]📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| vpc_security_group_ids = [ | |
| "${aws_security_group.web-node.id}"] | |
| vpc_security_group_ids = [ | |
| aws_security_group.web-node.id] |
🤖 Prompt for AI Agents
In terraform/aws/ec2.tf around lines 6-7 the vpc_security_group_ids list still
uses deprecated interpolation syntax "${aws_security_group.web-node.id}"; update
the entry to use the direct reference without quotes or interpolation
(aws_security_group.web-node.id) so the list is a plain Terraform expression
consistent with 0.12+ style.
|
/symbot review V6 |
Summary by CodeRabbit
Release Notes
Refactor
Chores