betr-io / terraform-provider-mssql

Terraform provider for Microsoft SQL Server
https://registry.terraform.io/providers/betr-io/mssql/latest
MIT License
36 stars 29 forks source link

Export SID property from user/login #35

Closed rjbell closed 2 years ago

rjbell commented 2 years ago

In our Terraform codebase, we’re trying to create a vulnerability assessment baseline resource (see Terraform doc):

resource "azurerm_mssql_database_vulnerability_assessment_rule_baseline" "vulnerability-assessment-baseline-va2130" {
  server_vulnerability_assessment_id = "<subscriptionid>"
  database_name                      = "<databasename>"
  rule_id                            = "VA2130"
  baseline_name                      = "default"
  baseline_result {
    result = [
      "<username>","<SID>"
    ]
  }
}

We can get the username attribute as an output variable from the ‘mssql_user’ resource (i.e. mssql_user.databaseuser.username) and supply it to the vulnerability assessment, but not the SID.

│ Error: Unsupported attribute
│ 
│   on ProjectLogin.tf line 142, in resource "azurerm_mssql_database_vulnerability_assessment_rule_baseline" "vulnerability assessment-baseline-va2130":
│  142:       mssql_user.databaseuser.username,mssql_user.databaseuser.sid
│ 
│ This object has no argument, nested block, or exported attribute named "sid". Did you mean "id"?
catt231 commented 2 years ago

this would be really good - would be great to see this asap