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

Error parsing azure server_id #10

Closed adlcr closed 3 years ago

adlcr commented 3 years ago

Hello,

I cannot create users in an azure database using this code. I'm using provider 0.2.1 with Terraform 0.13

resource "mssql_user" "user_all_read" {
      + authentication_type = (known after apply)
      + database            = "master"
      + default_schema      = "dbo"
      + id                  = (known after apply)
      + principal_id        = (known after apply)
      + roles               = [
          + "db_datareader",
        ]
      + username            = "app-all-read"

      + server {
          + host = "/subscriptions/1111-111-11-1/resourceGroups/reg-grp-01/providers/Microsoft.Sql/servers/sql-sl01"
          + port = "1433"

          + azure_login {
              + client_id     = "***"
              + client_secret = (sensitive value)
              + tenant_id     = "***"
            }
        }
    }

And this is the error:

mssql_user.user_all_read: Creating...

Error: unable to create user [master].[app-all-read]: parse "sqlserver://%2Fsubscriptions%2F21111-111-11-1%2FresourceGroups%2Freg-grp-01%2Fproviders%2FMicrosoft.Sql%2Fservers%2Fsql-sl01:1433": invalid URL escape "%2F"

I think it's not related, but my database collation is SQL_Latin1_General_CP1_CI_AS

magne commented 3 years ago

The server.host property should be the database server name, something like sql-sl01.database.windows.net.

magne commented 3 years ago

Closed since this is a resource configuration issue.