feat: update main.tf#9
Draft
asarkar157 wants to merge 1 commit into
Draft
Conversation
Closes #8
asarkar157
commented
Jun 9, 2026
asarkar157
left a comment
Contributor
Author
There was a problem hiding this comment.
Module Review — Grade: 🟠 D
The module has 2 CRITICAL security issues (public access enabled by default, no auditing/monitoring), 1 HIGH security issue (hardcoded permissive firewall rule), missing required_providers/version constraints, environment-specific variable defaults that break reusability, no tags merge pattern, stale README, and credential exposure in outputs. While the PR-specific change (zone_redundant) is well-implemented with proper typing, description, and tests, the underlying module has significant security and distribution readiness gaps that prevent org-wide distribution. The test failure is a mock_provider limitation, not a code defect.
📋 Variable Classification
| Variable | Type | Classification | Issue | Status |
|---|---|---|---|---|
server_name |
string |
REQUIRED | Missing validation block (Azure naming: 1-63 chars, lowercase+hyphens) | |
database_name |
string |
OPTIONAL | Default workshopdb is opinionated; README says Required but code has default |
|
resource_group_name |
string |
SHOULD BE REQUIRED | Default se-rg is environment-specific — should have no default |
❌ |
location |
string |
SHOULD BE REQUIRED | Default westus2 is environment-specific — should have no default |
❌ |
admin_login |
string |
REQUIRED | Missing validation (disallow admin, sa, length constraints) |
|
admin_password |
string |
REQUIRED | sensitive = true ✅ — missing complexity validation |
|
sku_name |
string |
OPTIONAL | Missing validation against known Azure SQL SKU names | |
max_size_gb |
number |
OPTIONAL | — | ✅ |
zone_redundant |
bool |
OPTIONAL | No cross-variable validation for SKU compatibility | |
tags |
map(string) |
OPTIONAL | — | ✅ |
🏗️ Module Structure
- ✅ Single/tightly-coupled resource pattern (server + DB + firewall)
- ✅ Resource naming uses
thisconvention - ❌ No tags merge pattern — raw
var.tagswithoutlocalsdefaults (ManagedBy, etc.) - ✅ No provider blocks inside module
- ✅ No terraform/backend blocks inside module
- ❌ No
versions.tf— missingrequired_providerswith version constraints ⚠️ Outputs missingserver_nameandzone_redundantstatus⚠️ README stale —zone_redundant,max_size_gbnot documented; Required/Optional inconsistencies- ✅ Tests exist under
tests/withmock_provider ⚠️ Environment-specific defaults baked into variables (se-rg,westus2)
🔒 Security Defaults
⚠️ Encryption at rest: Azure TDE is on by default, but module doesn't explicitly settransparent_data_encryption_enabled = true— relying on implicit defaults is fragile- ❌ Public access:
public_network_access_enablednot set (defaults totrue) — CRITICAL - ❌ Auditing/monitoring: No auditing policy, no extended auditing, no threat detection — CRITICAL
- ❌ Firewall: Hardcoded rule
0.0.0.0–0.0.0.0allows ALL Azure services — should be configurable via variable — HIGH - ✅ TLS:
minimum_tls_version = "1.2"explicitly set ⚠️ Deletion protection: Nolifecycle { prevent_destroy }for stateful resources⚠️ Credential exposure:connection_stringoutput embeds admin password — consumers should construct their own or use managed identity
🧪 Functional Validation
| Check | Result |
|---|---|
tofu fmt |
✅ PASS |
tofu init |
✅ PASS |
tofu validate |
✅ PASS |
tofu test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates the
main.tfTerraform module.Motivation
Closes #8
What's included
main.tfTerraform resources
azurerm_mssql_databaseazurerm_mssql_firewall_ruleazurerm_mssql_serverValidation
terraform fmtterraform validateterraform testReviewer notes
terraform-module-updateworkflow (StackGen terraform-bot).Failed check details
binary=OpenTofu v1.12.1; fmt=PASS; init=PASS; validate=PASS; test=FAILTest output (last 120 lines)