Skip to content

Fix outdated tf - #29

Open
alexiscolonna wants to merge 2 commits into
masterfrom
fix_outdated_tf
Open

alexiscolonna wants to merge 2 commits into
masterfrom
fix_outdated_tf

Conversation

@alexiscolonna

@alexiscolonna alexiscolonna commented Oct 23, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

Release Notes

  • Refactor

    • Updated infrastructure configuration syntax and structure for improved consistency and maintainability. Reorganized S3 storage settings to use modular resource definitions. These changes enhance code quality and clarity without affecting user-facing functionality.
  • Chores

    • Cleaned up configuration files to follow current best practices and standards.

@coderabbitai

coderabbitai Bot commented Oct 23, 2025 •

Copy link
Copy Markdown

Walkthrough

This 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

Cohort / File(s) Summary
Type Declaration Fixes
terraform/aws/consts.tf
Updated four variable blocks (ami, dbname, password, neptune-dbname) to use unquoted type syntax: changed type = "string" to type = string
String Interpolation Removal
terraform/aws/db-app.tf
Removed string interpolation from security group, IAM role, and subnet references; converted lifecycle ignore_changes from string list to unquoted identifier
terraform/aws/ec2.tf
terraform/aws/iam.tf
terraform/aws/kms.tf
terraform/aws/lambda.tf
Resource/Data Source Syntax Updates
terraform/aws/ecr.tf
Converted resource type declarations to quoted form: aws_ecr_repository → "aws_ecr_repository" and null_resource → "null_resource"
terraform/aws/es.tf
terraform/aws/eks.tf
S3 Resource Refactoring
terraform/aws/s3.tf
Migrated bucket configurations from inline ACL/versioning/logging/encryption to separate dedicated resources (aws_s3_bucket_acl, aws_s3_bucket_versioning, aws_s3_bucket_logging, aws_s3_bucket_server_side_encryption_configuration); replaced aws_s3_bucket_object with aws_s3_object

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

🐰 Interpolation chains unwound,
Direct references abound!
Types unquoted, syntax refined,
S3 buckets restructured, resized.
Terraform flows clean, aligned—
The code hops forward, redesigned! 🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title "Fix outdated tf" is overly vague and uses non-descriptive terminology that fails to convey meaningful information about the changeset. The PR contains substantial and varied changes across multiple Terraform files, including syntax standardization (quoted types and resources), removal of string interpolation, significant S3 resource refactoring (separating deprecated inline configurations into separate resources), field renames, and more. The term "outdated" is ambiguous and could refer to many different types of updates, while "tf" is an abbreviation that lacks clarity. A teammate scanning the commit history would not be able to understand the primary changes or scope of this PR based on the title alone. Consider revising the title to be more specific and descriptive. For example, a title like "Modernize Terraform syntax and refactor S3 resources" or "Remove string interpolation and fix deprecated resource types" would better communicate the scope and primary changes to reviewers. The title should highlight the most significant change or theme (likely the S3 resource refactoring given the "High" code review effort) while being concrete rather than generic.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_outdated_tf

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@symbiotic-vcs-preprod

symbiotic-vcs-preprod Bot commented Oct 23, 2025 •

Copy link
Copy Markdown

Symbiotic Security scan results

Hi @alexiscolonna, we've reviewed your PR and here are our findings:

⚠️ 11 new vulnerabilities
Id Severity Vulnerability File
V0 HIGH TF-0212
There is no encryption specified or encryption is disabled on the RDS Cluster.
terraform/aws/rds.tf (1-15)
V1 HIGH TF-0306
Ensure that Cloud SQL Database Instances are not publicly exposed
terraform/gcp/big_data.tf (9)
V2 HIGH TF-0306
Ensure that Cloud SQL Database Instances are not publicly exposed
terraform/gcp/big_data.tf (12)
V3 HIGH TF-0059
Legacy ABAC permissions are enabled.
terraform/gcp/gke.tf (12)
V4 HIGH TF-0114
RDS encryption has not been enabled at a DB Instance level.
terraform/aws/db-app.tf (18)
V5 HIGH TF-0490
RDS Publicly Accessible
terraform/aws/db-app.tf (21)
V6 HIGH TF-0350
Instances in a subnet should not receive a public IP address by default.
terraform/aws/ec2.tf (139)
V7 MEDIUM TF-0084
RDS Cluster and RDS instance should have backup retention longer than default 1 day
terraform/aws/rds.tf (4)
V8 MEDIUM TF-0300
Enable automated backups to recover from data-loss
terraform/gcp/big_data.tf (16)
V9 MEDIUM TF-0084
RDS Cluster and RDS instance should have backup retention longer than default 1 day
terraform/aws/rds.tf (20)
V10 MEDIUM 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
MEDIUM 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.

@alexiscolonna

Copy link
Copy Markdown
Contributor Author

/symbot review V6

@symbiotic-vcs-staging1

symbiotic-vcs-staging1 Bot commented Oct 23, 2025 •

Copy link
Copy Markdown

Symbiotic Security scan results

Hi @alexiscolonna, we've reviewed your PR and here are our findings:

⚠️ 28 new vulnerabilities
Id Severity Vulnerability File
V0 HIGH TF-0212
There is no encryption specified or encryption is disabled on the RDS Cluster.
terraform/aws/rds.tf (1-15)
V1 HIGH TF-0306
Ensure that Cloud SQL Database Instances are not publicly exposed
terraform/gcp/big_data.tf (9)
V2 HIGH TF-0306
Ensure that Cloud SQL Database Instances are not publicly exposed
terraform/gcp/big_data.tf (12)
V3 HIGH TF-0059
Legacy ABAC permissions are enabled.
terraform/gcp/gke.tf (12)
V4 HIGH TF-0114
RDS encryption has not been enabled at a DB Instance level.
terraform/aws/db-app.tf (18)
V5 HIGH TF-0490
RDS Publicly Accessible
terraform/aws/db-app.tf (21)
V6 HIGH TF-0350
Instances in a subnet should not receive a public IP address by default.
terraform/aws/ec2.tf (139)
V7 MEDIUM SYM_CONF_0235
Insufficient Verification of Data Authenticity
terraform/aws/ecr.tf (1-17)
V8 MEDIUM SYM_CONF_0279
Omission of Security-relevant Information
terraform/aws/ecr.tf (1-17)
V9 MEDIUM SYM_CONF_0281
Key Management Errors
terraform/aws/rds.tf (1-15)
V10 MEDIUM SYM_CONF_0196
Improper Access Control
terraform/gcp/big_data.tf (1)
V11 MEDIUM TF-0084
RDS Cluster and RDS instance should have backup retention longer than default 1 day
terraform/aws/rds.tf (4)
V12 MEDIUM TF-0300
Enable automated backups to recover from data-loss
terraform/gcp/big_data.tf (16)
V13 MEDIUM SYM_GEN_0100
Use of Hard-coded Credentials
terraform/aws/ec2.tf (16)
V14 MEDIUM 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
MEDIUM SYM_CONF_0026
Reliance on Insufficiently Trustworthy Component
.github/workflows/main.yml (16)
LOW SYM_CONF_0130
Exposure of Sensitive Information to an Unauthorized Actor
terraform/aws/eks.tf (10)
LOW SYM_CONF_0300
Key Management Errors
terraform/aws/s3.tf (23-40)
LOW SYM_CONF_0131
Exposure of Sensitive Information to an Unauthorized Actor
terraform/aws/es.tf (32)
LOW TF-0108
Buckets should have MFA deletion protection enabled.
terraform/aws/s3.tf (70-72)
LOW TF-0108
Buckets should have MFA deletion protection enabled.
terraform/aws/s3.tf (93-95)
LOW 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0178b7d and 6b1c6d4.

📒 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_changes are 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: The db_name field rename is correct and should be kept.

The db_name field is the current supported argument for specifying the initial database name in the aws_db_instance resource, while name was 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_arn properly references the IAM role, and depends_on uses 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 rule block (singular) and kms_master_key_id with 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_object to aws_s3_object is 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 import was 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) to type = 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

Comment thread terraform/aws/ec2.tf
Comment on lines 6 to 7
vpc_security_group_ids = [
"${aws_security_group.web-node.id}"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

Suggested change
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.

@alexiscolonna
alexiscolonna marked this pull request as draft October 24, 2025 09:54
@alexiscolonna
alexiscolonna marked this pull request as ready for review October 24, 2025 09:54
@alexiscolonna

Copy link
Copy Markdown
Contributor Author

/symbot review V6

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